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

2 次查看(过去 30 天)
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 个评论
qudsia Bashir
qudsia Bashir 2019-12-31
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)

请先登录,再进行评论。

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by