I would like to use the ode23 solver for systems. My system has three equations and the first one depends on an variable 'z' which is declared in the code above. Here“s the sample code:
clc; clear;
z=1;
function Fv=funsys(t,Y,z);
Fv(1,1)=2*Y(1)+Y(2)+5*Y(3)+exp(-2*t) + z;
Fv(2,1)=-3*Y(1)-2*Y(2)-8*Y(3)+2*exp(-2*t)-cos(3*t);
Fv(3,1)=3*Y(1)+3*Y(2)+2*Y(3)+cos(3*t);
end
[tv,Yv]=ode23('funsys',[0 pi/2],[1;-1;0]);
The get the error that the variable 'z' is not declared. So, is there any possibility to solve this? (The function 'funsys' needs to be dependent on 'z')