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

2 ビュー (過去 30 日間)
qudsia Bashir 2019 年 12 月 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 件のコメント1 件の古いコメントを表示1 件の古いコメントを非表示
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 2019 年 12 月 31 日
dw = diff(w,y);
condition2 = dw(-1) == 0;

サインインしてコメントする。

### カテゴリ

Help Center および File ExchangeParticle & Nuclear Physics についてさらに検索

### Community Treasure Hunt

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

Start Hunting!

Translated by