Question: Matlab 2n+1 sin(x) = 2n cos(x) - (2n)! n! n=0 To perform the summation, use a conditional while loop using the constant, eps, as your

Matlab  Matlab 2n+1 sin(x) = 2n cos(x) - (2n)! n! n=0 To

2n+1 sin(x) = 2n cos(x) - (2n)! n! n=0 To perform the summation, use a conditional while loop using the constant, eps, as your precision. Your functions must be able to work on scalars, vector or 2D matrices. This can be done using nested for loops to scan every element of the input array and use it as the value of x in the infinite series. Your functions must return an array of the same size as the input array where every element of the output array will be either the sine, the cosine or the exponential of every element of the input array and at the same position (row, column). For example, if the input array is [O pi/6 pi/3 pi/2 - -], the output of MySin function must be in the form [0 0.5000 0.8660 1.0000 ] (5 pts) Use your functions in the command window to determine the following a) sin(n/3): sin([-? -?/2 0 ?/2 b) cos(?/3); cos(l-r -r/2 0 ?/2 c) exp(I-5 -3 -1 2 4]) d) sin(A), cos(A), exp(A) where A ?) ?) [-pi:pi/3:pii -pi/2:pi/3:3 pi/2;- pi : pi/3:pi] Compare the results of your functions for parts a) to d) with that determined using the built in MATLAB functions sin, cos and exp. (10 pts) Write a script file HW7P4.m that uses your functions to produce One plot of the sine and cosine curve together in the interval-2? to 2?. You can use either the plot command with 100 points or the fplot () function. Use different line styles and annotate your plot. Another plot in a new figure window with 2 subplots in one column. The upper plot is your exponential function in the range 0.1 to 10 with linear scale for both the x and y axis. The lower plot is the same function with logarithmic scale for the y axis only

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!