solve a system of ode by bvp4c
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi, I am trying so solve a system of boundary value problem. I have tried looking into the examples given yet I still have problem in writing the code and running the program.
Briefly, I have 3 equations to solve. I have convert them to first order system in order to put it in matlab. Where, I let W=y1, W'=y2, U=y3, U'=y4, U''=y5, V=y6, V'=y7, V''=y8. I have the boundary 0f x from [0 infinity], and I choose infinity=20. I also need to plot graphs of x-axis:x (from 0 to 20) for y-axis:U, V and W respectively.
I know there are lots of mistakes here hence please correct me if Im wrong. I have attached the code here.
Thank you :))
3 Commenti
Taylor Nichols
il 24 Gen 2019
how did you arange the boundary conditions in your code if you don't mind me asking?
I've only done a ODE with one dependent variable in which I arranged my conditions this way
This is a 4th order equation btw.
bc = [yl(1) - hi;
yl(2);
yr(1) - ho;
yr(2)];
Risposta accettata
Torsten
il 15 Gen 2016
Solve your equations for W', U'' and V''.
Let
y(1) = W, y(2) = U, Y(3) = U', Y(4) = V, Y(5) = V'.
Your system then reads
Y(1)' = F0(Y(1),Y(2),Y(3),Y(4),Y(5))
Y(2)' = Y(3)
Y(3)' = F1(Y(1),Y(2),Y(3),Y(4),Y(5))
Y(4)' = Y(5)
Y(5)' = F2(Y(1),Y(2),Y(3),Y(4),Y(5))
Now use one of the ODE solvers in the usual manner.
Best wishes
Torsten.
3 Commenti
Torsten
il 15 Gen 2016
Modificato: Torsten
il 15 Gen 2016
Order equations (2) and (3) such that they look like
a1*U'' + b1*V'' = c1
a2*U'' + b2*V'' = c2
with a1, b1, c1, a2, b2, c2 expressions only depending on U, U', V, V', W and W'.
Then solve this (linear) system of equations from above for U'' and V'':
U'' = (c1*a2-c2*a1)/(b1*a2-b2*a1)
V'' = -(c1*b2-c2*b1)/(b1*a2-b2*a1)
Best wishes
Torsten.
P.S.: It seems you forget parentheses around expressions, e.g. (1-n/n+1) should be (1-n/(n+1)), I guess.
Più risposte (1)
Torsten
il 18 Gen 2016
I mean that the function F1 from above is given by
F1(W,U,U',V,V') = (c1*a2-c2*a1)/(b1*a2-b2*a1)
and the function F2 from above by
F2(W,U,U',V,V') = -(c1*b2-c2*b1)/(b1*a2-b2*a1)
Now you can define your array "dydx" in function "ex11ode" by
dydx = [-2Y(2)+x(1-n/n+1)Y(3)
Y(3)
F1(Y(1),Y(2),Y(3),Y(4),Y(5))
Y(5)
F2(Y(1),Y(2),Y(3),Y(4),Y(5))]
Best wishes
Torsten.
9 Commenti
Torsten
il 25 Gen 2016
Something like
c=(sol.y(4,:).^2+sol.y(5,:).^2).^((1-n)/(n+1));
plot(sol.x,c);
after the call to bvp4c should work.
Best wishes
Torsten.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!