Borrar filtros
Borrar filtros

how to run the loop 50 times and store the outputs

2 visualizaciones (últimos 30 días)
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD el 23 de Oct. de 2018
Comentada: madhan ravi el 23 de Oct. de 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

Respuesta aceptada

madhan ravi
madhan ravi el 23 de Oct. de 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 comentarios
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD el 23 de Oct. de 2018
this was simple and easy, thanx alot
madhan ravi
madhan ravi el 23 de Oct. de 2018
Anytime :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by