필터 지우기
필터 지우기

Nested for loop for beta and nu

조회 수: 1 (최근 30일)
brianna roberto
brianna roberto 2019년 11월 22일
답변: Pravin Jagtap 2019년 11월 25일
So for this problem we were to create a function called SIRode that has 4 inputs and 1 output. The outputs were time t, state y, beta and nu and the output was ydot.
so i created that function to call in the script using the ODE45.
But for beta and nu we have to create a nested for loops to investigate how different values for the parameters beta and nu afftect the simulation results.
  • use beta values of 0.005 and 0.05 and nu values of 0.02, 0.04, 0.06 and 0.08 and 0.1 for a total of 10 combinations.
Now I dont understand how to construct this nested loop so my ode45 reader puts the beta and nu each time so i can plot each different one.
attached i have my script and funciton file so far.
Thanks for looking at it for me.
  댓글 수: 2
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 11월 23일
편집: KALYAN ACHARJYA 2019년 11월 23일
?So for this problem we were to create a function called SIRode that has 4 inputs and 1 output. The outputs were time t, state y, beta and nu and the output was ydot.
1 output, but again you mentioned that outputs are time t, state y, beta and nu and the output was ydot.
Walter Roberson
Walter Roberson 2019년 11월 23일

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

답변 (1개)

Pravin Jagtap
Pravin Jagtap 2019년 11월 25일
From question and code, I assume that you are interested in solving coupled system of ODEs for different parameters. I have following suggestions for achieving the objective:
  • Use nested ‘for’ loops which will run over the values of ‘beta’ and ‘nu’ vectors and call ‘ode solver’ with proper parameters inside it. The indexing you used is incorrect since ‘for’ loops need integer iterator.
~Pravin

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by