Using deval (with an ode45 solver), the interpolation function returns the error "matrix dimensions must agree."

I am having trouble with MatLab's deval function when I am trying to run the following code:
clear all
load new_two_pauses_alpha_0.25_48.mat
t = linspace(0, 10.7339, 1000);
u = deval(odesolution, t);
The deval function seems to have no problem evaluating the odesolution structure (which is the structure returned by the MatLab function ode45) at x values contained in odesolution.x, seeing as the deval function is not required to do any interpolation. However, when the function must use interpolation in order to obtain an answer, it returns the following error:
Matrix dimensions must agree.
Error in ntrp45 (line 33)
yinterp = y(:,ones(size(tinterp))) + f*(h*BI)*cumprod([s;s;s;s]);
Error in deval (line 214)
yint2 = interpfcn(tint(evaluated+index2),t(bottom),y(:,bottom),...
Error in stochasticplotter (line 51)
u = deval(odesolution, t)
The code used to produce the odesolution structure is:
options = odeset('RelTol',0.001,'AbsTol',0.001,'MaxStep',0.001);
odesolution = ode45(@funct08,[t0,tfinal],u0,options,Setup2);
where Setup2 is a file containing parameter values, and the file new_two_pauses_alpha_0.25_48.mat contains the Setup2 parameters and the odesolution structure returned by ode45.

Answers (0)

Asked:

on 12 Dec 2017

Community Treasure Hunt

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

Start Hunting!