%Lesson 2 - Math 151 %first read in data from a file % load b:leafstat.dat %then read in a command file that is %this file of commands for MATLAB %by first telling MATLAB to use the b: drive % !b: %then telling it to run lesson2 % lesson2 %where lesson2.m is a file on your %floppy in the b: drive who,pause !c: plot(l,w,'+w') title('l versus w'),pause hist(l) title('l'),pause hist(w) title('w'),pause plot(l3,w3,'or') title('l3 versus w3'),pause hist(l3) title('l3'),pause hist(w3) title('w3'),pause plot(l,w,'+w',l3,w3,'or') title('length vs width'),pause meanl=mean(l),meanw=mean(w),pause meanl3=mean(l3),meanw3=mean(w3),pause plot(l,w,'+w',mean(l),mean(w),'or') title('l versus w with mean'),pause plot(l3,w3,'+w',mean(l3),mean(w3),'or') title('l3 versus w3 with mean'),pause stdl=std(l),stdw=std(w),pause stdl3=std(l3),stdw3=std(w3),pause plot(l,w,'+w',l3,w3,'or') title('length versus width'),pause c=polyfit(l,w,1),pause m=[min(l) max(l)] x=polyval(c,m) plot(l,w,'+w',m,x) title('l-w linear regression'),pause c2=polyfit(l3,w3,1),pause m2=[min(l3) max(l3)] x2=polyval(c2,m2) plot(l3,w3,'+w',m2,x2) title('l3-w3 linear regression'),pause plot(l,w,'+w',m,x,l3,w3,'og',m2,x2),pause