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?
조회 수: 2 (최근 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!