%-------------------------------------% % Lab Exercise 3 % % Date: 9/17/2002 % % % % Gun Srijuntongsiri % % gs61 % % ?????? % %-------------------------------------% % Task 2: clear % clear variables clc % clear screen % Task 3: echo on % Turn echo on % This comment line is shown in Command window. echo off % Turn echo off % This comment line is not shown in Command window. % Task 4: 3+2 % add 3 and 2 % Task 5: 4*7 % multiply 4 and 7 % Task 6: 1+3*4 % answer = 13 % Task 7: (1+3)*4 % answer = 16 % Task 6 and 7 results are different because the orders of computations % are different. In 6, 3*4 are computed before adding 1. In 7, 1+3 are % computed before multiply by 4. % Task 8: 3-2-1 3-(2-1) % 3-(2-1) = 3-2+1 which is not equal to 3-2-1 % Task 9: mod(11,4) % answer = 3 % Task 10: 1:15 % create a vector containing numbers from 1 to 15. % Task 11: color = 'white'; % Store 'white' to variable color. % Task 12: disp(['My favorite color is: ',color,'.']); % Task 13: ezplot('x^2'); % Plot y = x^2 % Task 14: figure % Open up new plot window ezplot('-3*x',[1,10]) % Plot y = -3*x, where 1 <= x <= 10.