Error using vertcat Dimensions of matrices being concatenated are not consistent

1 view (last 30 days)
I've looked at some other posts where people got this same error on this site but I can't figure out how to use the answers to fix my problem. I'm attaching my code - FluSeason.m being my script file and FluSeasonEQ.m being my model file - and if someone could look at it and tell me what's wrong, that would be phenomenal. This is the entire error message: This is the error: Error using vertcat Dimensions of matrices being concatenated are not consistent.
Error in FluSeasonEQ (line 51) dydt=[dsdt;didt;drdt];
Error in odearguments (line 87) f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 113) [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in FluSeason (line 44) [t,y] = ode45(@FluSeasonEQ,[0,104],y0,[],param);

Accepted Answer

Rachel Mac
Rachel Mac on 7 Dec 2015
I've sorted out the answer to the problem. In the model file, FluSeasonEQ.m, the spline interpolation of T includes a portion where t is defined: t=0:.05:104 But Matlab already had t defined in the function command at the start of the file. This resulted in errors concatenating the matrices. By removing the problematic line of code, the rest works.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!