Matlab - ode15s“输入参数太多”

时间:2017-04-27 03:09:40

标签: matlab ode

我正在尝试创建一个程序来解决聚合物反应的瞬间方法。但是,当我运行代码时,此错误出现“太多输入参数”,任何帮助? (抱歉英语不好)

代码:

第一个功能

function dydt = osc(t,y)


ka1 = 10^6;
ka2 = 0.15*10^6;
kp = 2952;
kd = 0.106*2952;
ks = 10^6;


%y=[C,A,ROH,I,M,Lambda,Mi] <=> y(1,:)=[C]   ;  y(2,:)=[A]
%                              y(3,:)=[ROH] ;  y(4,:)=[I]
%                              y(5,:)=[M]   ;  
%                              y(6-8,:)=[Lambda] onde: %y(6) - lambda0 ; 
                                        y(7) - lambda1 ; y(8) - lambda2
%                              y(9-11,:)=[Mi] onde: %y(9) - mi0 ; y(10) - 
                                        mi1 ; y(11) - mi2
%                              y(12,:)=[R1] ; y(13;:) = [D1]


j = 10; 
syms n


%Variables
dydt(1,1) = - ka1*y(1)*y(3) + ka2*y(4)*y(2) - ka1*y(1)
dydt(2,1) = + ka1*y(1)*y(3) - ka2*y(4)*y(2) + ka1*y(1)
dydt(3,1) = - ka1*y(1)*y(3) + ka2*y(4)*y(2) - ks*y(3)*
dydt(4,1) = - kp*y(5)*y(4) + kd*y(12) + ka1*y(1)*y(3) - ka2*y(4)*y(2) 
%Living Chains
dydt(6,1) = + ka1*y(1)*symsum((n^0)*y(9), n, [1 j]) 
dydt(7,1) = + ka1*y(1)*symsum((n^1)*y(10), n, [1 j]) 
dydt(8,1) = + ka1*y(1)*symsum((n^2)*y(11), n, [1 j])
%Dormant Chains
dydt(9,1) = - ka1*y(1)*symsum((n^0)*y(9), n, [1 j]) 
dydt(10,1) = - ka1*y(1)*symsum((n^1)*y(10), n, [1 j]) + 
dydt(11,1) = - ka1*y(1)*symsum((n^2)*y(11), n, [1 j]) 
%R1 e D1
dydt(12,1) = + kp*y(5)*y(4) - kp*y(5)*y(12) + kd*((y(12)+1) - y(12))
dydt(13,1) = - ka1*y(1)*y(13) + ka2*y(2)*y(13) + ks*y(3)*y(12)

end

第二功能

function [t,y]= call_osc()

%Tempo
tspan = [0 1];

%Initial conditions

C = 2.582;
A = 3.9*10^3;
ROH = 0.387*10^2;
I = 10^3;
M = 1460.495;
Rn0 = 0;
Rn1 = 0;
Rn2 = 0;
Dn0 = 0;
Dn1 = 0;
Dn2 = 0;
R1 = 1;
D1 = 1;

y0 = [C; A; ROH; I; M; Rn0; Rn1; Rn2; Dn0; Dn1; Dn2; R1; D1];

[t,y] = ode15s(@osc, tspan, y0);
disp(y(:,1))

end

0 个答案:

没有答案