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!