Intro to Matlab

From InterSciWiki

Jump to: navigation, search

these *.m programs and data are for students and tutorials, courtesy of Scott D. White See: Matlab code contributed by Scott D. White

set current directory

workspace ; command history; command window

editor

Contents

[edit] Data

[edit] .m programs

[edit] Sample programs

file open

[edit] "test_example1.m"

load_pajek has some documentation

e.g., parameter ,1) means UseWeights on edges

set breakpoint

continue with
f5


fr_graph fructerman

variables load in workspace

sparse(A) gives you the sparse representation of the matrix


full(A) matrix


DIJK dykstra slgorithm shortest path two nodes

put breakpoint at end to be inside and see internal variables

run pagerank on one of the nodes

distribution not sorted eg 1-34

[x_new,indxs]=sort(x) gives original index

BASIC commands

[edit] "test_example2.m"

create new pajek files

GRAPH W 4 NODES

; new row
spaces
[ ]


save

breakpoint
f10 step over
visualize
save to pajek

(Octave is freeware but doesn't support all the libraries matlab supports)


[edit] "test_example3.m"

Newman's clustering algorithm
applied to Zachary - 3 clusters (bc)
plot_cluster((A,coordinates,bc)

clear

[edit] "test_example4.m"

Personal tools