Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

functional values and graphs are not matching with this code

1 Ansicht (letzte 30 Tage)
MINATI
MINATI am 6 Okt. 2020
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
Pr = 1;
ODE = @(x,y) [y(2); y(3); -(1/2)*y(3)*y(1); y(5); - (Pr/2)*y(1)*y(5);];
BC = @(ya,yb)[ya(1);ya(2);ya(4)-1;yb(2)-1; yb(4);];
xa = 0; xb = 5; xn = linspace(xa,xb,100); x = xn;
solinit = bvpinit(x,[0 1 0 1 0]); sol = bvp5c(ODE,BC,solinit); S = deval(sol,x);
f0 = deval(sol,0);
t = sym('t'); x = sym('x');f(x) = sym('f(x)'); g(x) = sym('g(x)'); %Pr = sym('Pr');
eqns = [diff(f,x,3) == 0, diff(g,x,2) == 0];
Df = diff(f,x); D2f = diff(Df,x); Dg = diff(g,x);
cond = [f(0) == 0, Df(0) == 0, Df(5) == 1,g(0) == 1, g(5) == 0];
F = dsolve(eqns,cond); f1 = F.f; g1 = F.g; % disp([f1,g1])
f = zeros(1,1,'sym');g = zeros(1,1,'sym');fa = zeros(1,1,'sym');ga = zeros(1,1,'sym');
f(1) = f1; g(1) = g1;
n = 5;
for i = 1:n
fa(i) = subs(f(i),x,t);dfa = diff(fa(i),t,1);d2fa = diff(dfa,t,1);ga(i) = subs(g(i),x,t);dga = diff(ga(i),t,1);
If1 = -(1/2)*int(fa(i)*d2fa,t,0,t);If2 = int(If1,t,0,t); Ig1 = -(Pr/2)*int(fa(i)*dga,t,0,t);
f(i+1) = int(If2,t,0,x); g(i+1) = int(Ig1,t,0,x);
end
f(2)
f = f(1) + f(2) + f(3) + f(4) + f(5); g = g(1) + g(2) + g(3) + g(4) + g(5);
figure(1)
plot(xn,S(2,:),'LineWidth',1.5); %for f'
axis([0 5 0 1])
xlabel('\bf\eta'); ylabel('\bff^{\prime}(\eta)');
hold on
fplot(diff(f),[0 5],'--','LineWidth',1.5)
%%% Please follow attached pdf, while running the code, Figs and Eqns (26) - (28) & (30) - (32) are not matching. Have a try
  1 Kommentar
MINATI
MINATI am 7 Okt. 2020
I think any modification is needed to get correct result. to solve Eqns (17) - (24) and to draw Figs.

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by