MATLAB: How to run the loop 50 times and store the outputs

forloopoutputsstore

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

Best Answer

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