Function Quiz1 This Is Quiz Question 1 X Zeros (1,10) For I 1:10 X (I) I End y X 2/2+2x Plot (Y, X)
Function Quiz1 This Is Quiz Question 1 X Zeros (1,10) For I 1:10 X (I) I End y X 2/2+2x Plot (Y, X)
AY2010/2011
x2
2 x for
2
Identify and correct the 5 syntax and/or logical errors in the program.
(20 marks)
function quiz1
This is quiz question 1
x=zeros(1,10)
for i=1:10
x(i)=i;
end
y=x^2/2+2x;
plot(y,x)
2. Consider the following Matlab program quiz2:
function quiz2(a,b)
if b>a
disp('A')
elseif b<a
disp('B')
if b==a
disp('C')
else
disp('D')
end
end
Write down the output for each of the following inputs:
(a)
(b)
(20 marks)
Name:
AY2010/2011
n 3,4,5...