English 中文(简体)
谁能帮助我解决这一法典?
原标题:Could anyone help me to solve this code please?
  • 时间:2014-11-17 04:20:11
  •  标签:
  • matlab
  • plot

我正尝试采用一种可变的纸板,作为时间功能,使用插头1,但并不奏效,而是给我一种病媒,而不是因为我的融合而获得一种价值,

function RunLogisticOscilFisher

omega = 1;

k = 10;

N0 = 1;

A = 1;

p0 = .1;

tspan=(0:0.1:10);

% Finding the numerical solution for the function using ode45 solver

[t,p]=ode45(@logisticOscilfisher,tspan,p0,[],N0,k,omega);

% [t,p]=ode23s(@(t,p) N0*sin(omega*t)*p*(1-p./k),tspan,p0,odeset( AbsTol ,1e-8, RelTol ,1e-10 ));

% Plotting the function with time

figure(1)

plot(t,p)

% Finding the integral to get the fisher information with respect to p

f = @(p) ( ( A.*(((N0*sin(omega*t).^2.*(1-2*p./k))+(omega.*cos(omega*t) ) 

    ).^2)./(N0.^2*sin(omega*t).^4.*(p-p.^2./k).^2) ) ) 

I1=integral( f, 11,20, ArrayValued ,true)

I2=integral(f,11,40, ArrayValued ,true)

I3=integral(f,11,60, ArrayValued ,true)

I4=integral(f,11,80, ArrayValued ,true)

I5=integral(f,11,101, ArrayValued ,true)

I=[I1,I2,I3,I4,I5]

II=[I1./20 I2./40 I3./60 I4./80 I5./101]

T=[20 40 60 80 101] ;

%Plotting the Fisher Information

figure(2)

plot(T,I, b- ), hold on

plot(T,II, r- )

hold off

% Finding the integral to get the fisher information with respect to t

P = @(T) interp1(t,p,T);

ff = @(t)  ( A.*(((N0*sin(omega*t).^2.*(1-2*p./k))+(omega.*cos(omega*t) ) 

       ).^2)./(N0.^2*sin(omega*t).^4.*(p-p.^2./k).^2) ) 

J1=integral( ff, 0.1,2, ArrayValued ,true)

J2=integral( ff, 0.1,4, ArrayValued ,true)

J3=integral( ff, 0.1,6, ArrayValued ,true)

J4=integral(ff,0.1,8, ArrayValued ,true)

J5=integral(ff,0.1,10, ArrayValued ,true)

J=[J1,J2,J3,J4,J5]

JJ=[J1./2 J2./4 J3./6 J4./8 J5./10]

R=[2,4,6,8,10] ;

%Plotting the Fisher Information

figure(3)

plot(R,J, b- ), hold on

plot(R,JJ, r- )

hold off

figure(4)

plot(t,f(t))

figure(5)

plot(log(t),log(f(t)))

P = @(T) interp1(t,p,T);

a=exp(1-cos(t));

fff = @(T) (  ( A.* ( (sin(t)).^2 .* ( 1-2.*( a./ (9.9 + 0.1 .* a ) )./10 ) + cos(t) ).^2 

       ) ./ ( (sin(t)).^4 .* ( ( a ./ (9.9+(0.1.*a))) - ( ( a ./ ( 9.9 + ( 0.1 .* a) ) 

       ).^2 ./10 ) ).^2   )  )


K1=integral( fff, 0,2, ArrayValued ,true)

K2=integral( fff, 0,4, ArrayValued ,true)

K3=integral( fff, 0,6, ArrayValued ,true)

K4=integral(fff,0,8, ArrayValued ,true)

K5=integral(fff,0,10, ArrayValued ,true)

K=[K1,K2,K3,K4,K5]

KK=[K1./2 K2./4 K3./6 K4./8 K5./10]

%Plotting the Fisher Information

figure(6)

plot(R,K, b- ), hold on

plot(R,KK, r- )

hold off

1;

% function dpdt = logisticOscilfisher(t,p,N0,k,omega)

% dpdt = N0*sin(omega*t)*p*(1-p/k);

% end
问题回答




相关问题
MATLAB Solving equations problem

I want to solve these equations using MATLAB and I am sure there is a non zero solution. The equations are: 0.7071*x + 0.7071*z = x -0.5*x + 0.7071*y + 0.5*z = y -0.5*x - 0.7071*y +...

Difference between MATLAB s matrix notations

How do you read the following MATLAB codes? #1 K>> [p,d]=eig(A) // Not sure about the syntax. p = 0.5257 -0.8507 -0.8507 -0.5257 d = ...

preventing data from being freed when vector goes out of scope

Is there a way to transfer ownership of the data contained in a std::vector (pointed to by, say T*data) into another construct, preventing having "data" become a dangling pointer after the vector goes ...

Divide two polynomials using MATLAB

I want to divide p(x) by q(x) given that: p(x)=-5x^4+3x^2-6x q(x)=x^2+1 I tried: p=inline( -5*(x^4)+3*(x^2) , x ) p = Inline function: p(x) = -5*(x^4)+3*(x^2) q=inline( x^2+1 , x ) q = ...

matlab deals with Fibbonacci

The Fibonacci series is given as follows: 1, 2, 3, 5, 8, 13, 21, ... How can I write a script which calculates and prints the n-th Fibonacci term (for n>2), where n is inputed by the user. This ...

How do I plot lines between all points in a vector?

I have a vector containing some points in 2-D space. I want MATLAB to plot these points with lines drawn from every point to every other point. Basically, I want a graph with all vertices connected. ...

How do I create a string using a loop variable in MATLAB?

I have a loop like this: for i=1:no %some calculations fid = fopen( c:\out.txt , wt ); %write something to the file fclose(fid); end I want data to be written to different files like ...

热门标签