% Hi, I want to store the approximation for each k value that I have here in this code into an array so that I can print it out as a table.
% but I can't figure out how to do that.
% Any help appreciated. Thank you
for k = 1:10 x = pi/5; approximation = (-1^(k-1))*((x^(2*k-1))/(2*k-1)); prevApprox = (-1^(k-2))*((x^(2*k-2))/(2*k-2)); true = atan(x); trueError = ((true - approximation) / true)*100; approxError = ((approximation - prevApprox)/approximation)*100;end
MATLAB: Need to store for-loop values in array
arrayfor loopMATLABtable
Best Answer