0

请帮我!我收到此错误:“错误使用 Step1 输入参数过多。

Step2 出错(第 22 行)[y0,yp0] = feval('Step1',0, y0, yp0,{y,[]});"

这是我的程序的主体

 -    function Step1
    global a p1 p2 T s k1 k2 k3 k4 k5 
    k1=30;%F
    k2=10; %kon
    k3=100;%Stot
    k4=400;%kns
    k5=0.3; %koff
    a=4.6;
    p1=2;
    p2=5;
    T=20;
    s=1;
    %t0=0;
    %t=-10:1: 10;
    t0=-10;

    y=[0,0,0,0];
    y0=[0,0,0,0];
    yp0=[0,0,0,0];
    y=zeros(size(y));
    t=zeros(size(y));
    A = y(1); %Cafree
    B = y(2); %CaF
    C = y(3);  %CaS
    O = y(4);  %Caup
    %diff (A) = yp(1); %Cafree
    %diff(B) = yp(2); %CaF
    %diff(C) = yp(3);  %CaS
    %diff(O) = yp(4);
    if (t<0)
    [t,A,B,C,O]=[diff(B)-k1*diff(A),...
           diff(C)-k2*A*(k3-C)+k5*C,...
        diff(A)+diff(B)+diff(C)+diff(O),...
        diff(O)-k4*A,...
        diff(A)+diff(B)+diff(C)+diff(O)]
    if (0<=t<=T)
       [t,A,B,C,O]=[diff(B)-k1*diff(A),...
           diff(C)-k2*A*(k3-C)+k5*C,...
        diff(A)+diff(B)+diff(C)+diff(O),...
        diff(O)-k4*A,...
        diff(A)+diff(B)+diff(C)+diff(O)-diff(s-a*exp(-t/p1)+(a-s)*exp(-t/p2))];
     else
       [t,A,B,C,O]=[diff(B)-k1*diff(A),...
           diff(C)-k2*A*(k3-C)+k5*C,...
        diff(A)+diff(B)+diff(C)+diff(O),...
        diff(O)-k4*A,...
       diff(A)+diff(B)+diff(C)+diff(O)-diff(-a*exp(-t/p1)+(a-s)*exp(-t/p2)+s*exp(-(t-T)/p2))];
       end
    % Step1= [t,A,B,C,O]

    m=plot(t,A,B,C,O)

    end
    %p=nargout(Step1)

        end


****************************************88888888888888888888888888888

function calcul = Step2( t,y,yp)
global a p1 p2 T s k1 k2 k3 k4 k5 
k1=30;%F
k2=10; %kon
k3=100;%Stot
k4=400;%kns
k5=0.3; %koff
a=4.6;
p1=2;
p2=5;
T=20;
s=1;
% yp=sym(yp,'t','real')
%  syms yp set
 yp=[0,0,0,0];
% nargin(Step1)
t0=0;
y=[0,0,0,0];
y=zeros(size(y));
A = y(1); %Cafree
B = y(2); %CaF
C = y(3);  %CaS
O = y(4);  %Caup
t=[0:1:10];
y0=[0,0,0,0];
yp0=[0,0,0,0];
% % yp=[0,0,0,0];
% diff(A,t) = yp(1); %Cafree
% diff(B,t) = yp(2); %CaF
% diff(C,t) = yp(3);  %CaS
% diff(O,t) = yp(4);
options=odeset('RelTol',1e-5,'AbsTol',1e-4,'Jacobian',@Jac);
[y0,yp0] = feval('Step1',0, y0, yp0,{y,[]});
% [y0,yp0] = decic('Step1',0, y0,[1 1 1 1], yp0,[0 0 0 0],{y,[]});
[t,y]=ode15i('Step1',[0 10],y0,yp0,per,options);
plot(t,y)
grid on
return
end

感谢您的帮助!!英娜

4

1 回答 1

0

你定义你的功能,Step1

function Step1

这意味着您将 Step1 定义为不提供输出或接受输入,但在 中feval,您将其交给输入(并期望输出)。您的功能Step2已定义:

function calcul = Step2( t,y,yp)

其中有输出calcu1和输入t,y,yp。所以重新格式化你Step1的格式为Step2.

于 2013-07-13T14:38:54.537 回答