# dsolve problem gives error

조회 수: 3 (최근 30일)
MINATI PATRA 2022년 4월 12일
댓글: MINATI PATRA 2022년 4월 13일
M = 2; Kp = 5; Gr = 0.1; Gc = 0.1; L = 0.05; Pr = 1; S1 = 0.1; Sc = 0.78; Kc = 0.1;
syms x f0(x) g0(x) h0(x) f(x) g(x) h(x)
eqn0 = [ diff(f0,3) == 0, diff(g0,2) == 0,diff(h0,2) == 0 ];
cond0 = [f0(0) == 0, subs(diff(f0),0) == 0, subs(diff(f0),5) == 1, g0(0) == 1, g0(5) == 0, h0(0) == 1, h0(5) == 0];
F0 = dsolve(eqn0,cond0); f0 = F0.f0; g0 = F0.g0; h0 = F0.h0;
for k = 1:3
eqn = [ diff(f,3) + (1/2)*(f0*diff(f,2) + f*diff(f,2) + f*diff(f0,2)) - (M^2+Kp)*diff(f) + Gr*g + Gc*h == 0,diff(g,2) + Pr*( (1/2)*(f0*diff(g)+f*diff(g)+f*diff(g0)) + S1*g ) == 0, diff(h,2) + Sc *( (1/2)*(f0*diff(h)+f*diff(h)+f*diff(h0)) + Kc*h ) == 0];
cond = [f(0) == 0, subs(diff(f),0) == 0, subs(diff(f),xb) == 0, g(0) == 0, g(xb) == 0, h(0) == 0, h(xb) == 0];
F = dsolve(eqn,cond); f(k) = F.f;
end
fH = f0 + f1 + f2 + f3; fA = collect(fH,x);
figure(1),fplot(fA,[0 5],'LineWidth',2),xlabel('\bfx'); ylabel('\bff(x)');hold on
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
MINATI PATRA 2022년 4월 13일
Dear Torsten Please have a try.

댓글을 달려면 로그인하십시오.

### 답변 (1개)

Walter Roberson 2022년 4월 13일
xb not defined.
You are trying to create two boundary conditions for the same function, such as diff(f(x)) evaluated at xb = 0. dsolve cannot deal with multiple boundary conditions for the same derivative of the same function.
dsolve without boundary conditions solves to generate the form f(x) + C with unknown constant C. When you provide a boundary condition then it takes that f(x)+C and substitutes in the boundary location and equates to the known boundary value, such as f(0)+C = known and then solves for the constant. There are no remaining degrees of freedom to solve a second boundary at the same derivative level; such things would require solving for other variables.
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
MINATI PATRA 2022년 4월 13일
Ok, xb=5, I'm using f0 as first function. Using this, I want to calculate f1, f2, f3 through the code (2nd part) recursively which in turn can calculate fH.
Can it be modified to run.

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by