You are on page 1of 1

linspace (0,10,6)

x = 4:2:10
x = (4:2:10)'
x = x'
x = rand (1)
x= rand (5,2)
x = zeros (5,2)
save datafile.mat data
save ilovezeros x
%save [title] [file] - if no file, the entire workspace will be saved
load ilovezeros

v = data(6,2)
v = x(2,1)
v = x(end, 2)
density = data (2,:)
volume =data (1:3, :)

vm = max(va)
vr = round(va)

[3 4].*[1 2]
mass = density .* va

dsize = size (data)


[dr,dc] = size (data)
[vMax, ivMax] = max(v2) ---> [max value of vector, corresponding index value]

doc randi

plot(sample,mass1) --> plot(x axis, y axis)


plot(sample,v1,'r-o','LineWidth',5)
hold on ---> overlay graphs
title('Plot Title')
ylabel('Density (g/cm^3)')
legend(res,comm,ind) ---> if multiple graphs are plotted on same diagram
loglog(lambda,s,'-.') ---> for log graphs

close all

&|
v = v1(v1<4) --> v contains all elements of v1 that are less than 4
s = sample(v1<4) --> s contains all elements in 'sample' corresponding to where v1
is less than 4
v1(v1>5) = 10 --> all values in v1 greater than 5 are replaced by '10'

x=rand
if x>0.5
y=3;
else
y-4;
end

for idx = 1:5


disp(x(idx))
end

You might also like