필터 지우기
필터 지우기

how to run the loop 50 times and store the outputs

조회 수: 2 (최근 30일)
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2018년 10월 23일
댓글: madhan ravi 2018년 10월 23일
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

채택된 답변

madhan ravi
madhan ravi 2018년 10월 23일
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
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2018년 10월 23일
this was simple and easy, thanx alot
madhan ravi
madhan ravi 2018년 10월 23일
Anytime :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by