Nested for loop for beta and nu

1 visualizzazione (ultimi 30 giorni)
brianna roberto
brianna roberto il 22 Nov 2019
Risposto: Pravin Jagtap il 25 Nov 2019
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 Commenti
KALYAN ACHARJYA
KALYAN ACHARJYA il 23 Nov 2019
Modificato: KALYAN ACHARJYA il 23 Nov 2019
?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.

Accedi per commentare.

Risposte (1)

Pravin Jagtap
Pravin Jagtap il 25 Nov 2019
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

Categorie

Scopri di più su Function Creation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by