Uploaded by Swapnil Fegade

Swapnil 23FE10CCE00005 Assignment 3

advertisement
Name : Swapnil Fegade
REG no. 23FE10CCE00005
Section M2
B. TECH
Ist Semester: 2023-24; ME1006: MATLAB for Engineers
Assignment 3 (Release Date: 11th Apr 2024; Due Date: 18th Apr 2024)
Q1) What is the nature of the arrangement of the coefficients to store the following expression in MATLAB?
y= 3x⁵ + x² + 6
ANS: y=[3,0,0,1,0,6]
Q2) What will be the output for the below block of code? P=[1 3 2]; r=roots(P);
ANS:
Q3) What is the output of the following code?
for i=1:4
for j=1:4
a=5;a=a+5;
end end
ANS:
Q4)
What is the output of the following code?
i=0;for j=0:2
j=j-1 end
Name : Swapnil Fegade
REG no. 23FE10CCE00005
Section M2
ANS:
Q5) What will be the output for the following code?
k=0;i=0; while(k<1 && i<1) k=k+1;
i=i+1;i=i-k;
end
ANS:
Q6) What will be the output of the following code?
for i=1 : 3
i=i-1 end
ANS:
Name : Swapnil Fegade
REG no. 23FE10CCE00005
Section M2
Q7) What will be the output of the following code?
for i = 1 : 1 p=i-1 i=i+1;
clc
end
ANS:
Q8) What is the output of the following code? i=0; while[i<5] i=i+1; end
Name : Swapnil Fegade
REG no. 23FE10CCE00005
Section M2
Q9) If vector = [1 2 3 4; 11 24 92 100; 345 65 90 1]. What will the value of a be equal to if this code is entered into
MATLAB >>[a b] = size (vector)?
ANS:
Q10)
The number of iterations in the following loop is
p=3;for i=(3:4) p=p+2;
end
ANS:
Download