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!!"
![](https://writinghelpe.com/wp-content/uploads/2022/08/save.jpg)