Question

1) Write a script that plots sin(x), cos(x), tan(x) for x between 0 and 360◦ (or...

1) Write a script that plots sin(x), cos(x), tan(x) for x between 0 and 360◦ (or 2π radians) on one graph, adjusts the y axis to range between −10 and +10, and includes a legend identifying each line.

2)Write a Matlab function that sums up a specified number of odd-power terms from the Maclaurin series of sin(x) For example, if you use the function you wrote to sum the first 10 terms for x = 1, you should get 1 − 1/3! + 1/5! − 1/7! + 1/9! − . . . − 1/19! = 0.8414709848078965

3)Explain what is displayed when you type the following Matlab commands in sequence: x = 0:2:9; y = [-1 5 7 8 4 3]; sum(x) * y(3)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

1)

clc;
close all
clear all
x=0:0.01:2*pi;
y1=sin(x);
y2=cos(x);
y3=tan(x);
plot(x,y1,'r',x,y2,'b',x,y3,'g');
ylim([-10 10]);
xlim([0,2*pi])
legend('sin(x)','cos(x)','tan(x)');

2)

clc;
close all
clear all
sum=0;
x=input('Enter x: ');
n=input('Enter number of terms: ');
count=1;
term=x;
for i=1:n
sum=sum+term;
term=-term*x*x/((count+1)*(count+2));
count=count+2;
end
disp(sum)

3)

x=0:2:9 will create a vector x with elements 0,2,4,6,8

y is a row vector

sum(x)=0+2+4+6+8=20

y(3)=7

So, sum(x)*y(3)=140

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
1) Write a script that plots sin(x), cos(x), tan(x) for x between 0 and 360◦ (or...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT