Anzeige
Hello- using matlab- how do I approximate this sum- I Use While loop w.docx
Nächste SlideShare
Help! How to find A and B- Du Point Analysis- Calculate and interpret.docxHelp! How to find A and B- Du Point Analysis- Calculate and interpret.docx
Wird geladen in ... 3
1 von 1
Anzeige

Más contenido relacionado

Más de rtodd588(20)

Anzeige

Hello- using matlab- how do I approximate this sum- I Use While loop w.docx

  1. Hello, using matlab, how do I approximate this sum? I Use While loop write a script in MATLAB to calculate the approximate value of With the desired of accuracy within 10^6. Prefer to the example on lecture 7 slides (using for a loop) Hint: Write the While loop based on the following Pseudocode: 1st: Define s(1) and s(2) (1 and 2rd partial sums) 2nd: Start with element n=3 of list (n is which element comes next) 3rd: Loop s(n)=s(n-1)+next term n=n+1 REPEAT LOOP WHILE |s(n-1) - s(n2)| > 10^-6 4th: Display output appropriate explanation Solution s=[]; s(1)= sqrt(12); s(2)=s(1)+sqrt(-3); n=3; while abs(s(n-1)-s(n-2))>1e-6 s(n)=s(n-1)+sqrt(12.*(((-1).^n)./n.^2)); n=n+1; end s(n-1)
Anzeige