How could I plot this function ( I =A* sum( ( (dt.^2)*(B.^2) )/(C.^2) ) with time please? I am getting just a constant line while I expect to get a curve because it is a function of time.

조회 수: 1 (최근 30일)
I am working with this code but it does not give me the result that I expect :
function RunFisherfixedb
x0=[12 5];
dt = 0.055;
t=(0:dt:1);
n=length(t);
Iall=zeros(1,n);
for i = 1:n
I = Fisherfixedb(t,x0,A,dt);
Iall(i)=I;
end
figure(01)
plot(t,Iall,'k')
xlabel('Time')
ylabel('Fisher Information')
title('Average Fisher information in Two-species predator-prey model')
1;
% function I = Fisherfixedb(t,x,A,dt)
% a1 = 15*x(1) - 3*x(1)*x(2);
% b1 =-5*x(2) + 0.5*x(1)*x(2);
% C= (a1.^2) + (b1.^2);
% B = ( (a1.*(15-3*x(2))+b1.*(.5*x(2))).*a1 ) + ( (a1.*(-3*x(1))+ b1.*(-5+.5* x(1))).*b1);
% I = A*sum( (dt.^2)*((B.^2)/(C.^2)));
end
  댓글 수: 5
Guillaume
Guillaume 2014년 11월 4일
What is the result you see, and the result you expect?
Unfortunately, we can't test your function, since you haven't shown the code for the (badly named) system function.
Note that you may be better off starting a new question as most people won't be looking at a question that has been marked as answered. If you do that, pleas use the {} code button to format your code.
Avan Al-Saffar
Avan Al-Saffar 2014년 11월 5일
I posted a new question so could you have a look please?

댓글을 달려면 로그인하십시오.

채택된 답변

Guillaume
Guillaume 2014년 9월 11일
t is not used by your function Fisherfixeddb and all the other terms are constant, so of course, you get a constant line.
Fix your function to use t.
Note that you probably have a warning in the editor window precisely telling you that t is unused. Warnings are useful.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by