ODEs system

1 次查看(过去 30 天)
Andrea
Andrea 2011-7-26
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).

采纳的回答

Arnaud Miege
Arnaud Miege 2011-7-29
Also, there seems to be 4 variables, not three. Below is the modified code I used and the results I get with your parameters. Again, check the values and the units.
Pp=y(1);
Ps=y(2);
PASE_plus=y(3);
PASE_minus=y(4);
W12=(((sigmasa*gammas)/(h*Vs*A))*(Ps+PASE_plus+PASE_minus));
W21=(((sigmase*gammas)/(h*Vs*A))*(Ps+PASE_plus+PASE_minus));
R=((Pp*gammap*sigmapa)/(h*Vp*A));
N1=(rho*((1+W21*t)/(1+(W12+W21)*t+R*t)));
N2=(rho*((R*t+W12*t)/(1+(W12+W21)*t+R*t)));
dydz(1)=Pp*gammap*(sigmape*N2-sigmapa*N1)-alfap*Pp;
dydz(2)=Ps*gammas*(sigmase*N2-sigmasa*N1)-alfas*Ps;
dydz(3)=PASE_plus*gammas*(sigmase*N2- ... sigmasa*N1)+2*sigmase*N2*gammas*h*Vs*deltav-alfas*PASE_plus;
dydz(4)=-PASE_minus*gammas*(sigmase*N2- ... sigmasa*N1)+2*sigmase*N2*gammas*h*Vs*deltav+alfas*PASE_minus;
And this is how I call the|ode| solver:
[z,y]=ode45('signalFW',[0 20],[10 0.001 0 0]);
figure(1),subplot(2,1,1),plot(z,y(:,1:2)),grid on,ylabel('Power in mW'),legend('Pp','Ps');
subplot(2,1,2),plot(z,y(:,3:4)),grid on,xlabel('length EDFA in m'),ylabel('Power in mW'),legend('PASE+','PASE-');
This gives me the following results:
Is that what you'd expect? If not, check the values of your parameters.
Arnaud
  1 个评论
Andrea
Andrea 2011-7-29
Your results are the same as mine..maybe there is something wrong with the parameters. Thank you!

请先登录,再进行评论。

更多回答(2 个)

Arnaud Miege
Arnaud Miege 2011-7-27
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 个评论
Andrea
Andrea 2011-7-28
Can I send you an e-mail?
Arnaud Miege
Arnaud Miege 2011-7-29
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
Arnaud Miege 2011-7-29
This is the results I get with your code:
  2 个评论
Andrea
Andrea 2011-7-29
You can find the model and the result in these two articles (the correct model is in the second)
http://www.sendspace.com/file/uujskz
http://www.sendspace.com/file/c7abb0
Is my code correct (for the first iteration of the article's model?)
Arnaud Miege
Arnaud Miege 2011-7-29
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by