Question: Write a Matlab script to do the following The approximation of sine function can be evaluated using the following series: .25 2n+1 sin (1) =
Write a Matlab script to do the following

The approximation of sine function can be evaluated using the following series: .25 2n+1 sin (1) = 1 +(-1)" 3! 5! (2n + 1)! Evaluate the above equation using 1 to 10 terms (i.e. n=0:9) and store the values in a variable 'sine? Then calculate the percent relative error using the below equation: TrueValue - ApprorimatedValue error x 100 TrueValue Plot percent relative error vs number of terms used in the approximation (i.e. error vs n). Take x = Hint: Use a for loop to add the terms one by one to the approximation. After each term is added, store the value in a separate indexed variable (eg: approx(i) = sine), so that all the information is stored even if the variable 'sine' is overwritten ever time the for loop iterates. Matlab built in functions, a) to evaluate the true value, use true = sin(x) b) for factorial, 3! in matlab is written as factorial(3)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
