|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
已知程序如下:
Stochastic_Evolution程序如下:
clc;
rand('state',0);
T_Start=0;
T_End=100;
T_Step=0.01;%步长
T_Num=(T_End-T_Start)/T_Step;
A=0.02; %信号幅值
Omega=2*pi*0.05;% 频率ω=2*pi*f
D=0.0000011;%噪声强度
X(1)=0;
V(1)=0.0;
W(1)=0.0;
T_Axis(1)=0;
VV=0;
for i=1:T_Num
r1=rand(1);
r2=rand(1);
n1=sqrt(-2*log(r1))*cos(2*pi*r2);%式 16
t=i*T_Step;
Temp=X(i)+T_Step*Ufun(X(i),A,Omega,t);%为下式的Temp调用
X(i+1)=Temp+1.0/2*T_Step^2*Ufun(X(i),A,Omega,t)*Udiff(X(i))+sqrt(2*D*T_Step)*n1;%式 24
V(i+1)=V(i)+200*(T_Step*Ftf(V(i),W(i),A,Omega,t)+1.0/2*T_Step^2*Ftf(V(i),W
(i),A,Omega,t)*Fvf(V(i))+sqrt(2*D*T_Step)*n1);%由(9)得式26
W(i+1)=W(i)+T_Step*(V(i)-W(i)-0.15)-1/2*T_Step^2*(V(i)-W(i)-0.15);%式 26
S(i+1)=A*sin(Omega*t);
T_Axis(i+1)=t;
end;
figure;
plot(T_Axis,S);
figure;
plot(T_Axis,X);
figure;
plot(T_Axis,V);
figure;
function Ft_f=Ftf(V,W,A,Omega,t)
Ft_f=V*(V-0.5)*(1-V)-W+0.04+A*sin(Omega*t);
function Fv_f=Fvf(V)
Fv_f=-3*V^2+2*(0.5+1)*V-0.5;
function U_diff=Udiff(X)
U_diff=1-3*X^2;
function U_fun=Ufun(X,A,Omega,t)
U_fun=X-X^3+A*sin(Omega*t);
function [loc,val] = pickpeak(spec,npicks,rdiff)
%PICKPEAK Picks peaks
% [loc,val] = pickpeak(spec,npicks,rdiff)
% spec - data vector or matrix
% npicks - number of peaks desired [default = 2]
% rdiff - minimum spacing between picked peaks [default = 5]
% loc - vector of locations (indices) of the picked peaks
% val - vector corresponding values
% A 0 in location (i,j) of array loc (or a NaN in array val)
% indicates that the j-th data vector has less than i peaks
% with a separation of rdiff or more.
% Copyright (c) 1992-96, United Signals & Systems, Inc. and The Mathworks, Inc.
% $Revision: 1.2 $
% A. Swami Jan 20, 1995.
% RESTRICTED RIGHTS LEGEND
% Use, duplication, or disclosure by the Government is subject to
% restrictions as set forth in subparagraph (c) (1) (ii) of the
% Rights in Technical Data and Computer Software clause of DFARS
% 252.227-7013.
% Manufacturer: United Signals & Systems, Inc., P.O. Box 2374,
% Culver City, California 90231.
%
% This material may be reproduced by or for the U.S. Government pursuant
% to the copyright license under the clause at DFARS 252.227-7013.
% ---- parameter checks -------------------------------------------
if (exist('rdiff') ~= 1) rdiff = 5; end
if (exist('npicks') ~= 1) npicks = 2; end
% ---- convert row vectors to col vectors -------------------------
[mrows,ncols] = size(spec);
if (mrows==1) mrows=ncols; ncols=1; spec = spec(:); end
% ---- edit out NaNs and Infs ---------------------------------------
good = find (finite(spec));
rmin = min(spec(good)) - 1;
bad = find(~finite(spec));
if (~isempty(bad))
spec(bad) = ones(size(bad)) * rmin;
end
% ---- find a peak, zero out the data around the peak, and repeat
val = ones(npicks,ncols) * NaN ;
loc = zeros(npicks,ncols) ;
for k=1:ncols
% Find all local peaks:
dx = diff([rmin; spec(:,k); rmin]); % for a local peak at either end
lp = find(dx(1:mrows) >= 0 ...
& dx(2:mrows+1) <=0); % peak locations
vp = spec(lp,k); % peak values
for p=1:npicks
[v,l] = max(vp); % find current maximum
val(p,k) = v; loc(p,k) = lp(l); % save value and location
ind = find(abs(lp(l)-lp) > rdiff); % find peaks which are far away
if (isempty(ind))
break % no more local peaks to pick
end
vp = vp(ind); % shrink peak value array
lp = lp(ind); % shrink peak location array
end
end
以上是老师给的程序,要构造C*dV/dt=V-V^3-W+C/N*(Vi的综合)(i从1到N)。求C变化(C取三个不同的
值),N不变的,求V与t关系图形。 |
|