First Class Example

This example introduces us to the world of MATLAB/octave:

x = [1,2,2,2,1,4,6,7,5,3,4,5,7,9,8,6,4,3,2,3,4,5,6,3,3,2,3,4];median(x)

mean(x)

std(x)

y = [-10,0,3000];

lixo = ones(3,1);

lixo2 = [-1,0,1];

x = 20.*randn(10000,1);

[h,hind] = hist(x);

md = median(x)

mdp = md*lixo;

mn = mean(x)

mnp = mn*lixo;

st = std(x)

stp = st*lixo2;

yy = max(h)/sqrt(3)*lixo;

% plot(x)

% hold off to reset if we had it "on"

hold off

plot(hind,h)

hold on

plot(stp,yy)

plot(mdp,y)

plot(mnp,y)

%

% Another way to do median; for understanding

%

x = [1,2,2,2,1,4,6,7,5,3,4,5,7,9,8,6,4,3,2,3,4,5,6,3,3,2,3,4];

xs = sort(x);

ss = size(xs,2);

median2 = xs(ss/2)

%end

The student should try and follow this in MATLAB or octave to get a basic understanding of the interface and language. Try and take the following data b11104a4 and analyze it. To load this data just use the command:

octave:1> load b11104a4.dat

We can as an example get the mean of this data:

octave:2> mean(b11104a4)

See if you can look at this data with other functions that might help you extract some meaning in this data.

TO BE CONTINUED