Could anyone help me with the interp1 please?

1 次查看(过去 30 天)
I have a system of two equations with two variables,I am using ode45 to solve the system numerically then trying to find Fisher Information(I),,Because my variables x(1) and x(2) depend on time so I am using '' interp1 '' ,,The problem is that I am not sure of using ' interp1' and the second thing I am getting two values for (I) while I am expecting to get only one value!
My code is :
function RunFisherpaperInt
A=1;
x0=[12 5];
dt=0.1;
tspan=0:dt:100;
b=4;
[t,x]=ode45(@Fisherpaper,tspan,x0,[],b);
x=[x(:,1),x(:,2)];
X = @(T) interp1(t,x,T) ;
a1=(15.*X(1)-b.*X(1).*X(2)) ;
b1=(-5.*X(1)+0.5.*X(1).*X(2)) ;
f = @(T) (A.*( (( a1.*( a1.*(15 - b.*X(2)) + b1.*(0.5.*X(2)) ) + b1 .*(a1.*(-b.*X(1)) +b1.*(-5 +
0.5.*X(2)) ) ).^2)./(a1.^2+b1.^2).^3 ) ) ;
I = integral(f,0,100,'ArrayValued',true)
1;
% function dxdt = Fisherpaper(t,x,b)
%x(1) = prey
% x(2) = predator
% 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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by