24小时热门版块排行榜    

查看: 218  |  回复: 3

我要飞

铁虫 (正式写手)

[求助] 为何出错?

请大家看看这个程序为何出错?如何修改?谢谢了!
function [T, Y]=FOChen(parameters, orders, TSim, Y0)
%
format long e
% Numerical Solution of the Fractional-Order Chen's System
%
%   D^q1 x(t) = a(y(t)-x(t))
%   D^q2 y(t) = dx(t) - x(t)z(t) + cy(t)
%   D^q3 z(t) = x(t)y(t) - bz(t)
%
% function [T, Y] = FOChen(parameters, orders, TSim, Y0)
%
% Input:    parameters - model parameters [a, b, c, d]
%           orders - derivatives orders [q1, q2, q3]
%           TSim - simulation time (0 - TSim) in sec
%           Y0 - initial conditions [Y0(1), Y0(2), Y0(3)]
%
% Output:   T - simulation time (0 : Tstep : TSim)
%           Y - solution of the system (x=Y(1), y=Y(2), z=Y(3))
%
% Author:  (c) Ivo Petras (ivo.petras@tuke.sk), 2010.
%

% time step:
h=0.005;
% number of calculated mesh points:
n=100/h;
%orders of derivatives, respectively:
q1=0.99; q2=0.96; q3=0.92;
% constants of Chen's system:
a=10; b=1;
c=1; d=5;
% binomial coefficients calculation:
cp1=1; cp2=1; cp3=1;
for j=1:n
    c1(j)=(1-(1+q1)/j)*cp1;
    c2(j)=(1-(1+q2)/j)*cp2;
    c3(j)=(1-(1+q3)/j)*cp3;
    cp1=c1(j); cp2=c2(j); cp3=c3(j);
end
% initial conditions setting:
x(1)=0.5; y(1)=0.6; z(1)=0.1;
% calculation of phase portraits /numerical solution/:
for i=2:n
    x(i)=(a*(y(i-1)-x(i-1)))*h^q1 - memo(x, c1, i);
    y(i)=(-d*x(i)-x(i)*z(i-1)+c*y(i-1))*h^q2 - memo(y, c2, i);
    z(i)=(x(i)*y(i)-b*z(i-1))*h^q3 - memo(z, c3, i);
end
for j=1:n
    Y(j,1)=x(j);
    Y(j,2)=y(j);
    Y(j,3)=z(j);
end
T=h:h:TSim;
%

[ Last edited by 我要飞 on 2011-11-18 at 10:00 ]
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

引用回帖:
1楼: Originally posted by 我要飞 at 2011-11-18 09:34:21:
请大家看看这个程序为何出错?如何修改?谢谢了!
function [T, Y]=FOChen(parameters, orders, TSim, Y0)
%
format long e
% Numerical Solution of the Fractional-Order Chen's System
%
%   D^q1 ...

我估计运行时,可能会缺少某些函数,例如memo没有定义
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
2楼2011-11-18 10:18:17
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

我要飞

铁虫 (正式写手)

引用回帖:
2楼: Originally posted by dbb627 at 2011-11-18 10:18:17:
我估计运行时,可能会缺少某些函数,例如memo没有定义

请问这个如何修改就可以了?谢谢了
3楼2011-11-18 10:25:27
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

这个需要你看这个程序的出处,找到完整的程序代码。包括这个程序里面所用其他函数,主要是memo

[ Last edited by dbb627 on 2011-11-18 at 10:31 ]
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
4楼2011-11-18 10:30:05
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 我要飞 的主题更新
信息提示
请填处理意见