if I have this code :-
function S = triangle_wave(n) S = zeros(1,1001); %preallocation
e = []; for t = 0:((4*pi)/1000):(4*pi) for k = 0:n sigma = (((-1)^k)*sin((2*k+1)*t))/((2*k+1))^2; e(1, *???*) = sigma; *(%what should I put here instead of (???)?)*
end r = sum(e(:)); S(1, *???*) = r; *(%what should I put here instead of (???)?)* endend
I can't depend on the loop's variable because they are kinda of rational numbers, so how should i store ?
Best Answer