need to store for-loop values in array
이전 댓글 표시
% 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
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!