Question

Matlab Help

I understand and already did 2a. Need help with the Matlab part (2b).

2. (15 points) The Maclaurin series expansion of sin(x) is given by 3 sin)39 estimate the true value of sin(T/3). Calculate the truncation error (true percent relative error). (error between current and previous estimate) falls below 0.01%. Document the final value, the (a) Use the first three terms in this equation to calculate the value of sin(T/3). Use your calculator to (b) Now write a MATLAB program that adds the terms until the approximate percent relative error percent relative error (approximate and true), and the number of iterations it took.

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

clc
clear all
sum=0;
prev=0;
err=1;
count=0;
flag=1;
i=1;
x=pi/3;
while(abs(err)>0.01)
prev=sum;
sum=sum+flag*(x^i)/factorial(i);
flag=0-flag;
i=i+2;
count=count+1;
err=(sum-prev)*100;
end
disp('Final value')
sum
disp('Number of iterations')
count
disp('True error')
abs(sum-sin(x))
disp('Approximate error')
err

14- Command Window ④ New to MATLAB? Watch this Video, see Examples, or readGetting Started. 1F12 Final value sum 0.8660 Number of iterations count 5 True error ans 4.1315e-08 Approximate error err 4.1734e-04

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Matlab Help I understand and already did 2a. Need help with the Matlab part (2b). 2....
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
  • 4.2 The Maclaurin series expansion for cos x is 6 .8 Starting with the simplest version,...

    4.2 The Maclaurin series expansion for cos x is 6 .8 Starting with the simplest version, cos -I, add terms one at a time to estimate cos(π/3). After each new term is added, compute the true and approximate percent relative errors. Use your pocket calculator to determine the true value. Add terms until the absolute value of the approximate error estimate falls below an error crite- rion conforming to two significant figures.

  • Please show the full steps! 3. Find the MacLaurin series for f(x)cos(). Beginning with the first term of the series, add terms one at a time to estimate cos(.257). a) After adding each term, compute...

    Please show the full steps! 3. Find the MacLaurin series for f(x)cos(). Beginning with the first term of the series, add terms one at a time to estimate cos(.257). a) After adding each term, compute the true and the approximate percent relative errors b) Continue the iterative process of adding one term at a time until the approximate percent relative error falls below an error criterion for 4 significant figures (by hand). 3. Find the MacLaurin series for f(x)cos(). Beginning...

  • Aer wi rié error and percent relative error. Add terms until the absolute value of the...

    Aer wi rié error and percent relative error. Add terms until the absolute value of the error estimate falls below an error criterion conforming to two significant figures. 3. The following infinite series can be used to approximate ex: e =1+x+ (1.3) 2 3! n! (a) Show that this Maclaurin series expansion is a special case of Taylor expansion with x 0 and h=x (b) Use Taylor series to estimate f(x)=e* at x,=1 for x = 0.20. Employ zero-, first-,...

  • SOLVE USING MATLAB ONLY AND SHOW FULL CODE. PLEASE TO SHOW TEXT BOOK SOLUTION. SOLVE PART D ONLY

    SOLVE USING MATLAB ONLY AND SHOW FULL CODE. PLEASE TO SHOW TEXT BOOK SOLUTION. SOLVE PART D ONLY Apply Euler's Method with step sizes h # 0.1 and h 0.01 to the initial value problems in Exercise 1. Plot the approximate solutions and the correct solution on [O, 1], and find the global truncation error at t-1. Is the reduction in error for h -0.01 consistent with the order of Euler's Method? REFERENCE: Apply the Euler's Method with step size...

  • someone please do this corrcetly using matlab and following all instructions 1. (30 Points) It is...

    someone please do this corrcetly using matlab and following all instructions 1. (30 Points) It is known that the sine function can be expressed as: x(2k+1) sin(x) = (-1) +(2k + 1)! k=0 Truncate the series to compute the first seven estimates (ie, for k = 0,1,2,3,4,5, and 6) for x = You must use a for loop. All calculations and printing the table described below should be done from within the loop. For each estimate, determine the magnitude of...

  • i need the answer to be on a MatLab window 1. Consider the following equation, which...

    i need the answer to be on a MatLab window 1. Consider the following equation, which represents the concentration (c, in mg/ml) of a drug in the bloodstream over time (t, in seconds). Assume we are interested in a concentration of c2 mg/ml C3te-0.4t A. Estimate the times at which the concentration is 2 mg/ml using a graphical method Be sure to show your plot(s). Hint: There are 2 real solutions B. Use MATLAB to apply the secant method (e.g....

  • Submission Items: (1) A Word document in which you: a. Describe in brief the problem you...

    Submission Items: (1) A Word document in which you: a. Describe in brief the problem you are solving and the numerical method used. b. Snapshot of the output, when you run the program for the conditions mentioned in the questions. c. Discuss your results. (2) MATLAB code (m) file() Question 1: [10 points) Write a MATLAB function that calculates the approximate value of arctan(x) using the Maclaurin series approximation: arctan(x) = x- + +... The function should accept 3 parameters:...

  • This is a matlab HW that I need the code for, if someone could help me figure this out it would b...

    This is a matlab HW that I need the code for, if someone could help me figure this out it would be appreciated. The value of t can be estimated from the following equation: in your script file, estimate the value of π for any number of terms. You must ask the user for the desired number of terms and calculate the absolute error/difference between your calculation and the built-in MATLAB value ofpi. Display your results with the following message...

  • for part (b) I need to copy MATLAB code.. ex-1 Consider the function f(x) (a) Use...

    for part (b) I need to copy MATLAB code.. ex-1 Consider the function f(x) (a) Use the decimal format with five significant digits (apply rounding) to calculate (using a calculator) fix) for x = 0.005 (b) Use MATLAB (format long to calculate the value of x). Consider this to be the true value, and calculate the true relative error due to rounding in the value of x that was obtained in part (a).

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