problem in solving coupled non-linear Initial Value ODE using finite difference method
1 view (last 30 days)
Show older comments
Hi i wrote a code for 3 coupled non-linear Initial Value ODE ( u and w are second order and v is 1st order ODE) using finite difference method (forward scheme), but it doesn't work for me, the result for these ODE will be limit cycle oscillations but this generate wrong results. in need the result for t = 1:100 please help me in my code. Thanks.
Here is my code
t0=0;
Dt = 0.1;
tn = 6;
t = t0:Dt:tn;
n = (tn-t0)/Dt +1;%length(x);
u = zeros(1,n);
v = zeros(1,n);
w = zeros(1,n);
u0 = 0; %u(0)=0
u1 = 0.02; %u'(0)=0.02
v0 = 0; %v(0)=0
w0 = 0; %w(0)=0
w1 = 0; %w(0)=0
for j = 1:n-2
u(j+2) = 2*u(j+1)-u(j)+(Dt^2)*(-23.0665*(u(j)-v(j))+13.2617*((u(j)-v(j))^2)+5.3214*((u(j)-v(j))^3));
u(2)=u(1) - u1*Dt;
v(j+1) = v(j)+Dt*(0.2236*((u(j)-v(j))^3)-1.8198*((u(j)-v(j))^2)-0.0836*((u(j)-v(j)))+1.2263*(v(j)^2));
v(2)=v(1);
w(j+2) = 2*w(j+1)-w(j)+(Dt^2)*((-23.0665)*(u(j)-v(j))+0.0836*(0.02*Dt+(u(j)-v(j))+5.3214*((u(j)-v(j))^3)+13.2617*((u(j)-v(j))^2)+1.1872*(u(j)-v(j))*(0.02*Dt+u(j)-v(j))-0.6708*((u(j)-v(j))^2)*(0.02*Dt+u(j)-v(j))+2.4525*(u(j)-v(j))*(0.02*Dt+u(j))+2.4525*(0.02*Dt+u(j)-v(j))*u(j)-(-2.4525)*u(j)*(0.02*Dt+u(j))));
w(2)=w(1) - w1*Dt;
t(j) = t0 + (j-1)*Dt;
end
figure(1);
subplot(2,2,1);plot(t,u,'-');
subplot(2,2,2);plot(t,v,'-');
subplot(2,2,3);plot(t,w,'-');
0 Comments
Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!