# How to solve a final value problem?

Discussion in 'MATLAB' started by workaholic, Oct 20, 2008.

1. ### workaholicGuest

I wish to solve a final value problem of a nonlinear ordinary equation
group, how can I use the the Matlab to do that? It seems that there is

workaholic, Oct 20, 2008

2. ### Bruno LuongGuest

If your ode is backward equation with finale condition, you need to replace a time variable by its reverse to transform to forward problem.

If you have both initial and final condition, check out BVP5C.

Bruno

Bruno Luong, Oct 20, 2008

3. ### workaholicGuest

Thanks!

workaholic, Oct 20, 2008
4. ### workaholicGuest

Sorry, I still cannot work it out

My equation is like this:
s = zeros(15,1)£º
ds = -[ 56.6255+29.8194*s(1)+3.88810*s(6)+5.63478*s(11)+109.419*s(5)+
(s(2)+55.6844*s(5))*s(1)+(s(3)+6.33204*s(5))*s(6)+
(s(4)+9.17664*s(5))*s(11);
-329.633-13.5638*s(1)-9.26906*s(6)-31.2007*s(11)+109.419*s(10)+
(s(7)+55.6844*s(10))*s(1)+(s(8)+6.33204*s(10))*s(6)+
(s(9)+9.17664*s(10))*s(11);
213.265+10.4535*s(1)+10.7237*s(6)+32.9642*s(11)+109.419*s(15)+
(s(12)+55.6844*s(15))*s(1)+(s(13)+6.33204*s(15))*s(6)+
(s(14)+9.17664*s(15))*s(11);
-2483.44+29.8194*s(2)+3.88810*s(7)+5.63478*s(12)-4972.89*s(5)+
(s(2)+55.6844*s(5))*s(2)+(s(3)+6.33204*s(5))*s(7)+
(s(4)+9.17664*s(5))*s(12);
-752.718-13.5638*s(2)-9.26906*s(7)-31.2007*s(12)-4972.89*s(10)+
(s(7)+55.6844*s(10))*s(2)+(s(8)+6.33204*s(10))*s(7)+
(s(9)+9.17664*s(10))*s(12);
484.744+10.4535*s(2)+10.7237*s(7)+32.9642*s(12)-4972.89*s(15)+
(s(12)+55.6844*s(15))*s(2)+(s(13)+6.33204*s(15))*s(7)+
(s(14)+9.17664*s(15))*s(12);
122.248+29.8194*s(3)+3.88810*s(8)+5.63478*s(13)+199.089*s(5)+
(s(2)+55.6844*s(5))*s(3)+(s(3)+6.33204*s(5))*s(8)+
(s(4)+9.17664*s(5))*s(13);
-1022.78-13.5638*s(3)-9.26906*s(8)-31.2007*s(13)+199.089*s(10)+
(s(7)+55.6844*s(10))*s(3)+(s(8)+6.33204*s(10))*s(8)+
(s(9)+9.17664*s(10))*s(13);
1070.36+10.4535*s(3)+10.7237*s(8)+32.9642*s(13)+199.089*s(15)+
(s(12)+55.6844*s(15))*s(3)+(s(13)+6.33204*s(15))*s(8)+
(s(14)+9.17664*s(15))*s(13);
296.916+29.8194*s(4)+3.88810*s(9)+5.63478*s(14)+483.549*s(5)+
(s(2)+55.6844*s(5))*s(4)+(s(3)+6.33204*s(5))*s(9)+
(s(4)+9.17664*s(5))*s(14);
-3116.94-13.5638*s(4)-9.26906*s(9)-31.2007*s(14)+483.549*s(10)+
(s(7)+55.6844*s(10))*s(4)+(s(8)+6.33204*s(10))*s(9)+
(s(9)+9.17664*s(10))*s(14);
3195.41+10.4535*s(4)+10.7237*s(9)+32.9642*s(14)+483.549*s(15)+
(s(12)+55.6844*s(15))*s(4)+(s(13)+6.33204*s(15))*s(9)+
(s(14)+9.17664*s(15))*s(14);
54.2301+135.337*s(5)+3.88810*s(10)+5.63478*s(15)+s(1)+
(s(2)+55.6844*s(5))*s(5)+(s(3)+6.33204*s(5))*s(10)+
(s(4)+9.17664*s(5))*s(15);
-9.33297-13.5638*s(5)+96.2485*s(10)-31.2007*s(15)+s(6)+
(s(7)+55.6844*s(10))*s(5)+(s(8)+6.33204*s(10))*s(10)+
(s(9)+9.17664*s(10))*s(15);
7.73866+10.4535*s(5)+10.7237*s(10)+138.482*s(15)+s(11)+
(s(12)+55.6844*s(15))*s(5)+(s(13)+6.33204*s(15))*s(10)+
(s(14)+9.17664*s(15))*s(15)];

since s(t) is the vector variable, and the equation does not contain
explicitly a t variable, I don't know how to transform it into a
feasible form.
I notice that there is a odeset option" BDP", can it be used for that?
Anybody can help me? Thanks in advance!

workaholic, Oct 27, 2008
5. ### Torsten HennigGuest

I wish to solve a final value problem of a nonlinear >ordinary equation
dy/dt = f(t,y), y(tend) = y_end
make a change of variables according to
t~ = -t
y~(t~) = y(t)
You arrive at
dy~/dt~ = -f(-t~,y~(t~)), y~(-tend) = y_end
to be integrated between -tend and 0.
So in your case (if f does not contain t explicitely),
right-hand side and integrate between -tend and 0.

Best wishes
Torsten.

Torsten Hennig, Oct 27, 2008
6. ### workaholicGuest

Thanks a lot!

Best regards

workaholic, Oct 28, 2008