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
  • Convince yourself that the Maclaurin Series for cos(x) is: A. Write a function script called cos...

    Convince yourself that the Maclaurin Series for cos(x) is: A. Write a function script called cos_series that takes that takes as its inputs, x and N and has output given by the sum in the N-term Maclaurin Series approximation for Cos(x). Hint: try a “for loop” and set “format long” in your code. You may use the MATLAB built-in function factorial() B. Check your code by finding the 2-terms, 3-terms, 4-terms, 5-terms and 6-terms Maclaurin Series approximations every 30 degrees...

  • Find all solutions of the equation in the interval [0, 2π). tan"X-2 sec x =-1 write...

    Find all solutions of the equation in the interval [0, 2π). tan"X-2 sec x =-1 write your answer in radians in terms of π. If there is more than one solution, separate them with commas. Find all solutions of the equation in the interval [0, 2π). 2sin-10 Write your answer in radians in terms of t If there is more than one solution, separate them with commas.

  • Matlab Problem No. 5 (14 pts) (3-Digits) er: f(x) = x^1.2 + sin(x) - tan(x) =...

    Matlab Problem No. 5 (14 pts) (3-Digits) er: f(x) = x^1.2 + sin(x) - tan(x) = x^2.1-333,333 Find the sum for the function f(x) for each odd integer: f(x) * Domain of x values are: (153,457 to 942,345) odd integers only

  • Problem 1 MATLAB A Taylor series is a series expansion of a function f()about a given point a. For one-dimensional real...

    Problem 1 MATLAB A Taylor series is a series expansion of a function f()about a given point a. For one-dimensional real-valued functions, the general formula for a Taylor series is given as ia) (a) (z- a) (z- a)2 + £(a (r- a) + + -a + f(x)(a) (1) A special case of the Taylor series (known as the Maclaurin series) exists when a- 0. The Maclaurin series expansions for four commonly used functions in science and engineering are: sin(x) (-1)"...

  • 4. Given (x)=x-5x + 5x5x2 - 6x , write a symbolic MATLAB script that: (a) plots...

    4. Given (x)=x-5x + 5x5x2 - 6x , write a symbolic MATLAB script that: (a) plots g(x) in the interval -2 <x< 4, (b) finds and display all of its maxima and minima, (c) evaluates g(x) at the following values of x: -21, 21, 0, 1, 2st and displays the five results. tidad

  • A periodic signal, x(t) is shown below. A = 10, T-4 sec. -T Write a MATLAB script to plot the sig...

    A periodic signal, x(t) is shown below. A = 10, T-4 sec. -T Write a MATLAB script to plot the signal, using enough points to get a smooth curve. Compute the Fourier series coefficients for the signal (if you can find them in the text, that is ok). Plot the single-sided or double-sided spectra for each signal. Include enough frequencies in the plots to adequately represent the frequency content of the signals. Plot partial sums of the Fourier series for...

  • Find the integral using matlab quad inbuilt for function (x^2)*cos(x)+3*sin(x)*tan(x) for 0 to pi/4

    Find the integral using matlab quad inbuilt for function (x^2)*cos(x)+3*sin(x)*tan(x) for 0 to pi/4

  • Task 2: (1 Mark) - Scripts Write a MATLAB script which plots the absolute error between...

    Task 2: (1 Mark) - Scripts Write a MATLAB script which plots the absolute error between your mySqrt() function and the built-in sqrt() function for a variety of N values with: N=1:20 • n=323158 err-le-3. Your plot should clearly show that error decreases until "saturating" somewhere below err. Because the algorithm "converges” (increased in accuracy) very quickly the true accuracy will be several orders of magnitude better than the err value. You should use semilogy () instead of plot() to...

  • write matlab script 5. Use a for loop to sum the elements in x = [1...

    write matlab script 5. Use a for loop to sum the elements in x = [1 2 3 4 5] Check your answer with sum function 6. Use a while loop to sum the elements in x = [1 2 3 4 5] Check your answer with sum function

  • **Please show all work** Consier the function sin x/xx #0 f(x) = {inz/# x = 0...

    **Please show all work** Consier the function sin x/xx #0 f(x) = {inz/# x = 0 (a) Find the MacLaurin series for f (x). (b) Suppose we want to estimate the value of f (0.5). Use the above series to write a finite sum approximating f (0.5). Write enough terms to be sure that your sum is within 0.000001 of the correct answer (and how how you determine how many terms you need).

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