dde23: Derivative and history vectors have different lengths.
이전 댓글 표시
Hi, I'm trying to solve a very basic set of time-delay differential equations with dde23. All my code is below. collFunc2 is the driver, which sets three time lags -- taui, taug, tauf -- and calls dde23 on the set of three coupled differential equations -- dnidt -- in collFunc2. The history values are constant and zero in coll2hist. When I try to run this I get 'Derivative and history vectors have different lengths.' Both seem to be three columns long to me. What am I doing wrong? Thanks so much for any help. - Sylvia
function sol = collision2
taui = 15*60;
taug = 30*60; % graupel growth time
tauf = 10*60; % fallout time
lags = [taui, taui + taug, taui + taug + tauf];
sol = dde23(@collFunc2,lags,@coll2hist,[0,1000]);
function [t,dnidt] = collFunc2(t,y,Z)
alpha = 2.4*10^(-5); % volume sweep out rate [m3 s-1]
N = 50; % multiplication rate
ylag1 = Z(:,1); ylag2 = Z(:,2); ylag3 = Z(:,3);
dnidt(1) = alpha*N*((y(2)*y(3) - ylag1(2)*ylag1(3)));
dnidt(2) = alpha*N*(ylag1(2)*ylag1(3) - ylag2(2)*ylag2(3));
dnidt(3) = alpha*N*(ylag2(2)*ylag2(3) - ylag3(2)*ylag3(3));
function s = coll2hist(~)
% Constant history function
s = [0; 0; 0];
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Structural Mechanics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!