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!