ODE- How to solve this equation??
1 回表示 (過去 30 日間)
古いコメントを表示
Hi Im trying to solve this differential equation:
dydt=((g0.*L-y)./tau)-((Pin./Esat)*(exp(y)-1));
by ODE45: [T Y]=ode45(@(t,y) fun(t,Y,It,I),[0 3],0);
but it doesnt work... I guess becouse it based on example3 from ODE45 help which looks like this: dydt = -f.*y + g,(y'(t) + f(t)y(t) = g(t))
but here I have the "exp(y)" which I dont know how to hadle with.
g0=R*a*n0*((I/I0)-1); I is a vector dependent on t. L,tau,Pin,Esat,R,a,n0,I0 are constant.
any suggestion may help. thanks
1 件のコメント
Arnaud Miege
2011 年 6 月 1 日
Please reformat your code. See http://www.mathworks.co.uk/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
回答 (3 件)
Igor
2011 年 6 月 1 日
be exactly in y(t) definition and remember that y(t) is a COLUMN vector.
also in -- @(t,y) fun(t,Y,It,I) -- you use y and Y!
0 件のコメント
Laura Proctor
2011 年 6 月 1 日
The following code worked for me:
dydt=@(t,y)(((g0*L-y)/tau)-((Pin/Esat)*(exp(y)-1)));
[T Y]=ode45(dydt,[0 3],0);
But, I did have to make some guesses at the constant values, such as g0, L, tau, Pin, and Esat.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!