Info
この質問は閉じられています。 編集または回答するには再度開いてください。
The result is not what I want it is completely different ,,so Is there anyone could help me to use another routines to get the result for this code please?
1 回表示 (過去 30 日間)
古いコメントを表示
This code what I am doing,, My problem is in plot(4),The result is not what I want it is completely different ,,so Is there anyone could help me to use another routines to get the result for this code please?
function Runfisher
A=1;
b=3;
x0=[12 5];
dt=0.01;
tspan=0:dt:1;
[t,x]=ode45(@fisher,tspan,x0,[],b);
figure(1)
plot(t,x)
figure(2)
plot(x(:,1),x(:,2),'-')
grid
dt= 0.095;
a1 = ( 15*x(1) - b*x(1).*x(2) );
b1 = ( -5*x(2) + 0.5*x(1).*x(2) );
I = A.*(dt.^2).*sum.*( ( ( ( (a1.*(15-b*x(2))+b1.*(.5*x(2))).*a1 ) + ( (a1.*(-b*x(1))+ b1.*(-5+.5*x(1))).*b1) ).^2)./(( (a1.^2) + (b1.^2) ).^2) )
ball=2:1:10 ;
n = length(ball) ;
Iall = zeros(1,n) ;
for i = 1 : n
[t,x]=ode45(@fisher,(0:0.0001:1),x0,[],ball(i)) ;
figure(3)
plot(x(:,1),x(:,2))
hold on
dt= 0.095;
a1 = ( 15*x(1) - ball(i).*x(1).*x(2) );
b1 = ( -5*x(2) + 0.5*x(1).*x(2) );
I = A.*(dt.^2).*sum.*( ( ( ( (a1.*(15-ball(i).*x(2))+b1.*(.5*x(2))).*a1 ) + ( (a1.*(-ball(i).*x(1))+ b1.*(-5+.5*x(1))).*b1) ).^2)./(( (a1.^2) + (b1.^2) ).^2) ) ;
Iall(i) = I
end
figure(4)
plot(ball,Iall,'r-')
1;
% function dxdt = fisher(t,x,b)
% dxdt=zeros(2,1);
% dxdt(1) = 15 * x(1) - b * x(1).* x(2);
% dxdt(2) = -5 * x(2) + .5 * x(1).* x(2);
% end
The right plot for figure(4) should increase until (ball =3 ) then it will deceasing until the last value. But what I am getting is just increasing line . I do not what is the reason so could anyone help me please?
13 件のコメント
Torsten
2014 年 11 月 5 日
Sorry, the numbers on the right should be one order of magnitude smaller (I divided by 1000, not by 10000).
Best wishes
Torsten.
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!