Effacer les filtres
Effacer les filtres

how to run the loop 50 times and store the outputs

2 vues (au cours des 30 derniers jours)
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD le 23 Oct 2018
Commenté : madhan ravi le 23 Oct 2018
Dear all, I have a function to generate the values of y based on 50 reading s from x, i tried this for loop but i do not know how to store the 50 outputs? it jut gives me the last output, this is my code
for x=(1:50)
fun=52537*(((0.00001*x^4)-(0.0003*x^3)+(0.0093*x^2)-(0.0843*x)+(0.1721))*(0.1534*exp(-0.089*((x-9.911)^2)))+...
((0.00001*x^4)-(0.0003*x^3)+(0.0093*x^2)-(0.0843*x)+(0.1721))*(0.0175*exp(-0.215*((x-18.416)^2)))+...
((0.00001*x^4)-(0.0003*x^3)+(0.0093*x^2)-(0.0843*x)+(0.1721))*(0.0032*exp(-0.06*((x-21.173)^2))));
end

Réponse acceptée

madhan ravi
madhan ravi le 23 Oct 2018
for x=(1:50)
fun(x)=52537*(((0.00001*x^4)-(0.0003*x^3)+(0.0093*x^2)-(0.0843*x)+(0.1721))*(0.1534*exp(-0.089*((x-9.911)^2)))+...
((0.00001*x^4)-(0.0003*x^3)+(0.0093*x^2)-(0.0843*x)+(0.1721))*(0.0175*exp(-0.215*((x-18.416)^2)))+...
((0.00001*x^4)-(0.0003*x^3)+(0.0093*x^2)-(0.0843*x)+(0.1721))*(0.0032*exp(-0.06*((x-21.173)^2))));
end
fun
  3 commentaires
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD le 23 Oct 2018
this was simple and easy, thanx alot
madhan ravi
madhan ravi le 23 Oct 2018
Anytime :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by