Filter löschen
Filter löschen

how to run the loop 50 times and store the outputs

2 Ansichten (letzte 30 Tage)
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD am 23 Okt. 2018
Kommentiert: madhan ravi am 23 Okt. 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

Akzeptierte Antwort

madhan ravi
madhan ravi am 23 Okt. 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 Kommentare
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD am 23 Okt. 2018
this was simple and easy, thanx alot

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by