error in bvp4c "??? Undefined function or method 'mtimes' for input arguments of type 'struct'.

2 views (last 30 days)
Hi
I'm solving the following code using bvp4c
function mat4bvpcasympt
n=100;
x=linspace(0,1,n+1);
f=0.2*x.^2;
H=1-f;
S=spline(x,H);
solinit = bvpinit(linspace(0,1,n),@mat4init);
sol = bvp4c(@mat4ode,@mat4bc,solinit,[],S);
xint=linspace(0,1);
phis=real(deval(sol,xint));
%% S is the interpolation function input arguments
function dydx = mat4ode(x,y,S)
dydx =[y(2)
-exp(-1/2*y(1))*S];
%% And I get the following errors:
??? Undefined function or method 'mtimes' for input arguments of type 'struct'.
Error in ==> mat4bvpcasympt1>mat4ode at 85 dydx =[y(2)
Error in ==> bvparguments at 116 testODE = ode(x1,y1,odeExtras{:});
Error in ==> bvp4c at 130 [n,npar,nregions,atol,rtol,Nmax,xyVectorized,printstats] = ...
Error in ==> mat4bvpcasympt1 at 51 sol = bvp4c(@mat4ode,@mat4bc,solinit,[],S);
Can someone help me to encounter the error? Thanks in advance

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!