need to store for-loop values in array
Show older comments
% 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
Accepted Answer
More Answers (0)
Categories
Find more on Matched Filter and Ambiguity Function in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!