Calculating results for Partial Sums
3 views (last 30 days)
My question is:
Calculate the result and absolute error for each partial sum: N = 10, 160, and 640. You should use for-loops and not commands like symsum.
I keep on getting weird answes in Matlab and was wondering if my code was missing something:
%(a) Calculate the result and absolute error for each partial sum: N = 10, 160, and 640.
for N=[10 160 640]
PLEASE DO NOT GIVE ME THE COMPLETE ANSWER TO THE QUESTION. I WOULD JUST LIKE AN EXPLANATION OF WHAT I AM DOING WRONG.
ME on 10 Jan 2020
The main problem here is that you arent actually summing the y values as you go along. You are not adding y to the sum like you should, instead you are calculating all of the y values, ignoring them and adding 1 to the sum instead.
You would also probably be better off indexing your sum and error values so that you get one value for each of the Ns you input.
You have asked not to see the code so I haven't included it, but please comment below if you'd like me to add it!