I tried to do a remain sum using matlab and graph it,
why is my sumvec vector is 101? should the while loop runs from 10 to 100
sum = 0
sumvec = []
for n = 10:100
sum = 0
width = (3 - 0)/n
for c = 0:n
base = width * c
height = sqrt(base+1)
sum = sum + (width * height)
end
sumvec(n+1) = sum
end
figure;
i = 0:101
scatter(i,sumvec)
1 Comment
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/656393-why-is-my-vector-bigger-than-how-i-created#comment_1152108
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/656393-why-is-my-vector-bigger-than-how-i-created#comment_1152108
Sign in to comment.