how to write initial condition v'(0)=0 in matlab

6 views (last 30 days)
i want to write the condition v'(-1)=0 in matlab but my code given below give error. Someone please help me.
code:condition=diff(v,y==-1,1)=0
  2 Comments
qudsia Bashir
qudsia Bashir on 31 Dec 2019
This is the code which i am using and its giving error when i try to write the condition v'(0)=0
clear all
syms v(y) m beta w(y) z(y) p gamma
p=-0.1;m=0.1;beta=2;
ode = diff(v,y,2) ==m^2*v;
cond1 = v(-1) == 0;
cond2 = diff(v,y==-1,1) == gamma;
conds = [cond1 cond2];
vSol(y)=dsolve(ode,conds)
v = vpa(vSol)
f = diff(w,y,2) ==m^2*w-6*beta*diff(v,y,1)^2*diff(v,y,2)+p;
condition1 = w(-1) == 0;
condition2 = diff(w,y==-1,1) == 0;
condition = [condition1 condition2];
wSol(y) = dsolve(f,condition);
w = vpa(wSol)
g = diff(z,y,2) ==m^2*z-6*beta*(2*diff(v,y,1)*diff(v,y,2)*diff(w,y,1)+diff(v,y,1)^2*diff(w,y,2));
condi1 = z(-1) == 0;
condi2 = diff(z,y==-1,1) == 0;
condi = [condi1 condi2];
zSol(y) = dsolve(g,condi);
z = vpa(zSol)
HPM=vpa(v+w+z)
y=-1:0.1:1
eval(HPM)
eval(z)

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 31 Dec 2019
dw = diff(w,y);
condition2 = dw(-1) == 0;

Categories

Find more on Sparse Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!