need to store for-loop values in array
Afficher commentaires plus anciens
% 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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matched Filter and Ambiguity Function dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!