8. MATLAB Command Window To get started, type one of these: helpwin, helpdesk, or demo. For product information, type tour or visit www.mathworks.com. » » help HELP topics:
9.
10.
11.
12.
13.
14.
15.
16. MATLAB Command Window » who Your variables are: a b c » whos Name Size Bytes Class a 8x8 512 double array b 9x9 648 double array c 9x9 648 double array Grand total is 226 elements using 1808 bytes
84. IF Condition if condition {commands} end If x = 2 output = ‘x is even’ end
85. WHILE Loop while condition {commands} end X = 10; count = 0; while x > 2 x = x / 2; count = count + 1; end
86. FOR Loop for x=array {commands} end for n = 1:10 x(n) = sin(n); end A = zeros(5,5); % prealloc for n = 1:5 for m = 5:-1:1 A(n,m) = n^2 + m^2; end disp(n) end
93. Quick Answer (!) function c = mypoly(a,b) % MYPOLY Add two polynomials of variable lengths % mypoly(a,b) add the polynomial A to the polynomial % B, even if they are of different length % % Author: Damian Gordon % Date : 3/5/2001 % Mod'd : x/x/2001 % c = [zeros(1,length(b) - length(a)) a] + [zeros(1, length(a) - length(b)) b];