Set 7 No 2 Problem Description Use a for loop to calculate the terms in the math
ID: 3804789 • Letter: S
Question
Set 7 No 2 Problem Description Use a for loop to calculate the terms in the mathematical sequence and its corresponding harmonic series, 1/1-1/2 1/3-1/4 1/5 1/50 Your answer should be a table with the first column being n, the second column is a n and the third column is S n with 6 decimal places shown. Solution MATLAB Documentation 1 you should use a for loop to build the values of the sequence and series summation 2 you can then display the answer outside of the loop 3 Use the variable TABLE as the answer, that is what is being referenced for the answer Submit Test Reset You have unlimited submissions v Test SuiteExplanation / Answer
MATLAB Code:
sum =0;
for n=1:1:1000
sum=sum+(1/n^2);
end
estimated_pi=sqrt(6*sum);
disp(estimated_pi)
OUTPUT:
run_pi
3.1406
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.