Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

= 4 4/3 + 4/5 4/7 + 4/9 Write a MATLAB program with a for loop to compute (and display) an approximation A of using

 = 4  4/3 + 4/5  4/7 + 4/9  Write a MATLAB program with a for loop to compute (and display) an approximation A of  using a truncation of the given sum. Your program should allow the user to enter the number of terms (denoted by nterms, say) to be used for the approximation. Also in the program, compute (and display) the absolute error E = |A  | (using the MATLAB function abs for the absolute value). *For this particular question the code what i have written isnt working, could you help me? could you help me to fix the error clear format long nterms=input('Enter the number of terms used for the approximation of pi:'); A=4; disp(' Approximation(A) Absolute Error (E)') n=2 If(n>=2 < nterms) A = A +(-1)^(n-1)*(4/(2*n-1)); Else E =abs (A - pi); disp([A E])

end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

What is the relation of physical mathematics with examples?

Answered: 1 week ago

Question

What are oxidation and reduction reactions? Explain with examples

Answered: 1 week ago

Question

LO5 Highlight five external recruiting sources.

Answered: 1 week ago