% % my first matlab script % (note the "percent" signs indicate non-executed comment lines) % % save as: "hw00a.m" % to run: type "hw00a" at the matlab prompt (note: you may have to set % the directory/folder into the matlab path), or use the "run" menu % choice (not sure of exact PC name of run script menu choice). % % browser help: type "helpdesk" at the matlab prompt % % instant help: type "help xxxx" for help about command xxxx % (try "help clf", etc) % %- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % make a vector series from 0 to pi x = 0:pi/50:pi; y = tan(x/4); % plot the function y(x) clf plot(x,y) hold on plot(x,y,'r.') % label my plot (!!! very important !!!) title('my first plot of y(x)') xlabel('x-axis') ylabel('y-axis') axis([0 pi 0 1]) text(0.2,0.90,'this is a plot of the function y(x) = tan(x/4) ...') text(1.5,0.80,'... from x = 0 to \pi !') disp(' ') disp(' done') disp(' ')