write a matlab program 1 Given the function y = x + x 2 evaluate y for x in the
ID: 3860903 • Letter: W
Question
write a matlab program
1 Given the function y = x + x 2 evaluate y for x in the range /2 to /2, in increments of 0.6 . Display this as a two column table, with the values of x being in the first column and y in the second. Save this script in a file named evaluate3.m.
2 . Given the function y = x + xtan(x) evaluate y for x in the range to radians, in increments of 1.1 . Display this as a two column table, with the values of x being in the first column and y in the second. Save this script in a file named evaluate4.m.
3 Given the function y = xsin(x) + xcos(x) evaluate y for 42 evenly spaced values of x in the range 130 degrees to 130 degrees. Display this as a two column table, with the values of x being in the first column and y in the second. Save this script in a file named evaluate5.m.
Explanation / Answer
1.
x=[];
y=[];
i=1;
for x=-pi/2:0.6:pi/2
x(i)=x;
y(i)=x+x*2;
end
x=reshape(x,[lenghth(x),1]);
y=reshape(y,[lenghth(y),1]);
t=table(x,y)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.