Octave

Load data from a tab delimited file (octave sizes the array for you). The semicolon supresses the console output:

a = load sphstate.00001;

Copy just the first column into another matrix. The two arguments in the brackets are row,column ranges. E.g. (1:5,1:5) is a slice with the first five rows and first five columns.

b = a(:,1)

Plot the first two columns against each other:

plot( a(:,1), a(:,2), ‘@’)

The @ specifies point style.

Plot a 3D surface:
[rho,p] = meshgrid(0:0.05:2,0:0.05:1);
t=zeros(size(rho)(2),size(p)(2));
t = (1./rho) .* (1 .- (rho ./2)) .* (p .+ (2 .* (rho .** 2)));
mesh(rho,p,t[0:2])

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: