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

조회 수: 2 (최근 30일)
qudsia Bashir
qudsia Bashir 2019년 12월 30일
답변: Walter Roberson 2019년 12월 31일
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
darova
darova 2019년 12월 30일
Attach the entire problem/code
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에서 Sparse Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by