Академический Документы
Профессиональный Документы
Культура Документы
%
% Short MatLab tutorial
%
% Aaron Shon & Rajesh Rao, University of Washington
% 16 April 2002
%
%
% * THE 2 MOST IMPORTANT COMMANDS:
%
% 1. help <subject>
% 2. lookfor <subject>
%
% Other useful commands:
%
% diary <filename> -- Start writing the diary to <filename>
% diary off -- Turn off the diary
% save <filename> -- Save all variables in your workspace to <filename>
% save <filename> x y z -- Save variables x,y,z to <filename>
% more on -- Stop output from scrolling by
% more off -- Allow output to scroll by
fprintf('(PAUSED)');
pause;
% The axis command changes the drawing axes using the format:
%
% axis([minX maxX minY maxY]);
axis([0 2*pi -1 1]);
fprintf('\n\n(PAUSED)');
pause;
plotVec = 0:0.1:2*pi;
% Length gets you the length of a vector
N = length(plotVec);
% Size gets you the size of things with multiple dimensions
[numRows numCols] = size(randMat);
for i=1:N
% Plot one point from a cosine curve using red x symbols
plot(plotVec(i),cos(plotVec(i)),'rx');
% Force drawing now
drawnow;
% Pause for 0.2 sec
pause(0.2);
end
recursionDepth = 10;
% We can also call functions
[fibNum] = fibonacci(recursionDepth);