Your task is to take the below

Your task is to take the below code, and insertcomments (using the “%” symbol) next to each line of code to makesure that you know what every line does.

clcclearclose allNMax = 100;partialSum = 0;exactAnswer = pi^2;

for k=1:NMaxpartialSum = partialSum + 6/k^2;percentDiff(k) = abs(partialSum -exactAnswer)/exactAnswer*100;end

NVector = [1:NMax];plot(NVector,percentDiff);xlabel(‘{{Noob}}’);ylabel(‘% Difference’);

Answer:

clc

clear

close all

NMax = 100; % maximum number upto which difference between exactanswer and partial sum is compared

partialSum = 0; % starting value of partial sum

exactAnswer = pi^2; % answer against which partial sum iscompared

for k=1:NMax % k will go from 1 to Nmax with increment of 1

partialSum = partialSum + 6/k^2; % formula to calculate partialsum

percentDiff(k) = abs(partialSum – exactAnswer)/exactAnswer*100;% ‘% difference between partal sum and exact answer’

end

NVector = [1:NMax]; % vectror created to plot

plot(NVector,percentDiff); % plotting Nvector on x axis anddifference on y axis

xlabel(‘{{Noob}}’); % label of x axis

ylabel(‘% Difference’); % label of y axis


 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"

Calculate your order
Pages (275 words)
Standard price: $0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back
If you're confident that a writer didn't follow your order details, ask for a refund.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Power up Your Academic Success with the
Team of Professionals. We’ve Got Your Back.
Power up Your Study Success with Experts We’ve Got Your Back.