Mostrar comentarios más antiguos
i'm trying to solve this system of differential equations, can someone told me how to use the ODE45 function?
dPp/dz= Pp*gammap*(sigmape*N2 −sigmapa*N1)−α*Pp;
dPs/dz= Ps*gammas*(sigmase*N2 −sigmasa*N1)−α*Ps:
dPASE/dz=PASE*gammas*(sigmaSE*N2-sigmasa*N1)+2*sigmase*h*gammas*Vs*Δv-alfas*PASE;
with N1=ρ*(1+W12*t)/(1+(W12+W21)*t+R*t)
N2=ρ*(R*t+W21*t)/(1+(W12+W21)*t+R*t)
W12=[(sigmasa*gammas) / (h*Vs*A)](Ps+PASE) W21=[(sigmase*gammas) / (h*Vs*A)](Ps+PASE) R=[(Pp*gammap*sigmapa) / (h*Vp*A)](Ps+PASE)
(gammap,gammas,sigmase,sigmape,sigmapa,sigmasa,h,Vs,Vp,A,Δv,α,ρ are known parameters).
Respuesta aceptada
Más respuestas (2)
Arnaud Miege
el 27 de Jul. de 2011
0 votos
Have a look at the examples provided in the documentation. You need to write a function that computes the derivatives of your variables as a function of time and the variables themselves, and pass this to the ode solver.
HTH,
Arnaud
11 comentarios
Andrea
el 27 de Jul. de 2011
Arnaud Miege
el 28 de Jul. de 2011
I noticed there's no dependency on z in the calculation of dydz. Is that intentional? I can't really comment on the correctness of your equations, it's up to you to check that. The solver is able to solve the equations, so if the results are not what you expect, you probably want to double-check your equations are correct.
I also notice that you are multiplying/dividing some pretty small numbers by some pretty large ones. You might want to try and scale some of your parameters/variables to get a better conditioned system.
Andrea
el 28 de Jul. de 2011
Arnaud Miege
el 28 de Jul. de 2011
If the derivatives of these variables do not depend on z through the differential equations (which is what you have in your code), then that's fine. If they do depend on z, then something's not right. The equations may be right, but have you checked they're coded correctly in MATLAB? Also, what do you mean by "the results are not so good".
Andrea
el 28 de Jul. de 2011
Matt Tearle
el 28 de Jul. de 2011
Minor dumb thing: your function is signalFW but you're calling ode45 on signalFWprova. Assuming these are the same, I get sensible-looking results, so maybe you should post a link to the article or something like that so we can see what the results should look like.
Arnaud Miege
el 28 de Jul. de 2011
Good point, thanks Matt.
Andrea
el 28 de Jul. de 2011
Arnaud Miege
el 28 de Jul. de 2011
I don't have an account, so can't access either publication.
Andrea
el 28 de Jul. de 2011
Arnaud Miege
el 29 de Jul. de 2011
Can you just upload an image of the equations and the results you expect for certain numerical parameters?
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
Arnaud Miege
el 29 de Jul. de 2011
0 votos
This is the results I get with your code:

2 comentarios
Andrea
el 29 de Jul. de 2011
Arnaud Miege
el 29 de Jul. de 2011
The code looks correct if you refer to equations (1) to (9) of the paper. However, you should check that the units used for the various parameters are consistent, and that the numerical values make sense.
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
