MATLAB: Hi, I tried to use ode23 by using Matlab (R2009), but I get error message ” unbalanced or unexpected parenthesis or bracket”. why there is error because using “~”.

ode23

[t1,~] = ode23(@(t,x) deriv(t,x,0, xd, @(t) u(z,t)), [0 2], init(xd),opt);

Best Answer

We would have to see more of your code to know what the problem is.
You are defeating the purpose of integrating your ODE because you are suppressing the output of the integrated function and returning only the time vector.
Completely guessing here, but see if this works:
[t1,x1] = ode23(@(t,x) deriv(t,x,0, xd, u(z,t)), [0 2], init(xd),opt);