Reputation: 337
I created a symbolic function in MATLAB R2021b using this script with the goal of solving an ODE.
syms phi(x) lambda L
eqn_x = diff(phi,x,2) == -lambda*phi;
dphi = diff(phi,x);
cond = [phi(0)==0, dphi(1)==0]; % this is the line where the problem starts
disp(cond)
phi = dsolve(eqn_x,x,cond);
This script runs without any errors, but I want to evaluate dphi(L)==0
instead of at x=1. When I try to do this instead, I get the following error.
Obviously, the way MATLAB is interpreting dphi(L)==0
is not correct since it is replacing the dependent parameter x with L which should be an independent parameter. Can someone recommend a fix or workaround?
I've also tried this dphi(x==L)==0
and I got the same error.
Addition following kikon's comment I tried both options suggested based on the tutorial. These are the results.
dphi | x = L
creates a parse error in MATLABdphi | x == L
gives this result. This seems to indicate x=l OR dphi/dx which is not a condition. I'm tempted to try &
in place of |
to get an and, but this may not be sufficient.subs(dphi, x = L)
gives the same condition when I use dphi(L)==0
which is incorrect.Upvotes: 0
Views: 84