Asked by Xuan Ling Zhang
on 17 Oct 2019

Hi, I have a problem when i use the shooting method. That is the Jacobian matrix calculated approximately from the finite difference method is too expensive to obtain. Not only that, i should run the Ode45 solver many times. Anyone can give some suggestions？In addition, how to obtain the sufficiently reasonable values of initial guesses(i.e., d_1, d_2, d_3, d_4) ?

Thank you in advance！

The specific description of this problem is given as follows：

Function main %

d_1=8.5513e-011;d_2=3.4673e-004;d_3=3.4673e-004;d_4=-0.0034;%The current guesses

L=0.5;

span=[0 L];

options = odeset('RelTol',1e-5,'AbsTol',1e-6);

delta=1e-12;

init_0=[0 d_1 0 d_2 0 0 d_3 d_4];

[x,y0]=ode45(@Comp,span,init0,options);

Init_1=[0 d_1+delta 0 d_2 0 0 d_3 d_4]; Init_2=[0 d_1 0 d_2+delta 0 0 d_3 d_4];

Init_3=[0 d_1 0 d_2 0 0 d_3+delta d_4]; Init_4=[0 d_1 0 d_2 0 0 d_3 d_4+delta];

[x,y1]=ode45(@Comp,span,Init1,options);[x,y2]=ode45(@Comp,span,Init2,options);

[x,y3]=ode45(@Comp,span,Init3,options);[x,y4]=ode45(@Comp,span,Init4,options);

%% the following：the first column

Df(1,1)=(y1(end,1)-y0(end,1))/delta; Df(2,1)=(y1(end,3)-y0(end,3))/delta; Df(3,1)=(y1(end,5)-y0(end,5))/delta;

Df(4,1)=(y1(end,6)-y0(end,6))/delta; % DF is

%% the following：the tecond column

Df(1,2)=(y2(end,1)-y0(end,1))/delta; Df(2,2)=(y2(end,3)-y0(end,3))/delta; Df(3,2)=(y2(end,5)-y0(end,5))/delta;

Df(4,2)=(y2(end,6)-y0(end,6))/delta;

%% the following：the third column

Df(1,3)=(y3(end,1)-y0(end,1))/delta; Df(2,3)=(y3(end,3)-y0(end,3))/delta; Df(3,3)=(y3(end,5)-y0(end,5))/delta;

Df(4,3)=(y3(end,6)-y0(end,6))/delta;

%% the following：the forth column

Df(1,4)=(y4(end,1)-y0(end,1))/delta; Df(2,4)=(y4(end,3)-y0(end,3))/delta; Df(3,4)=(y4(end,5)-y0(end,5))/delta;

Df(4,4)=(y4(end,6)-y0(end,6))/delta;

B=Df;

End

% The init_j (j=0,1,2...) is the initial condition. d_i (j=1,2,3) are the unknown initial parameters and are evaluated using those current guesses, which is actually the so-called process of shooting. Df is the Jacobian matrix mentioned above.

Function dy= Comp (x,y)

G1=-9.3799e-016; G2 =-3.2988e-020; G3=8.8425e+003; G4=0.3121; G5=1.1243e+006;

G6=4.4751e-012; G7=-5.1691e-015; G8=4.2188e+007; G9=0.1536; f0=23; L=0.5;

dy=zeros(8,1);

dy(1) = y(2);

dy(2) = G1*(y(3)+y(6))+G2*y(8)-y(6)*y(7);

dy(3) = y(4);

dy(4) = G3*(y(3)+y(6))+G4*y(8);

dy(5) = y(6);

dy(6) = y(7);

dy(7) = y(8);

dy(8)=G5*(y(4)+y(7))+G6*y(4)*y(7)+G7*y(7)*y(7)+G8*y(2)*y(7)+G8*y(6)*y(6)*y(7)/2+G9*f0*sin(pi*x/L);

end

% The boundary conditions of the nonlinear equations described by the code 'dy=Comp (x,y)' is: y(1)= y(3) = y(5) = y(6)=0，at x=0 and L

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.