dsolve problem gives error

1 view (last 30 days)
MINATI PATRA
MINATI PATRA on 12 Apr 2022
Commented: MINATI PATRA on 13 Apr 2022
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 Comment
MINATI PATRA
MINATI PATRA on 13 Apr 2022
Dear Torsten Please have a try.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 13 Apr 2022
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 Comment
MINATI PATRA
MINATI PATRA on 13 Apr 2022
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!