can anyone help me. I am getting error of the following problem
6 views (last 30 days)
Show older comments
bb_go
function [y]=bb_go
% defining parameters
b=0.2,R=0.5,M=0.2,L=2, Pr=0.4;
sol1 = bvpinit(linspace(0,3,5),[1 0 1 0 1]);
sol = bvp4c(@bvp2D,@bc2D,sol1);
x = sol.x;
y = sol.y;
%%% Plotting of the velocity
figure (1)
plot(x, y(2, :) ,'linewidth', 1)
hold on
xlabel('\eta', 'fontweight', 'bold', 'fontsize', 16)
ylabel('f^/(\eta)', 'fontweight', 'bold', 'fontsize', 16)
%% Residual of the boundary conditions
function residual = bc2D(y0, yinf)
residual=[y0(1); y0(2); y0(3)-1; yinf(2); yinf(3)];
end
%% System of First Order ODEs
function yvector = bvp2D(t,y)
yy1 = (1/(1+1/b))*(M*y(2)-y(1)*y(3)-L*(1-y(2)*y(2)));
yy2=(1/(1+R))*Pr*(y(2)*y(3)-y(1)*y(4));
yvector = [y(2);y(3);y(4);yy1;yy2];
end
end
1 Comment
Chuguang Pan
on 12 Nov 2025
What is the dimension of state vector y, it seems that the dimension of y is 4 but the yvector is 5.
Accepted Answer
Torsten
on 12 Nov 2025
Moved: Torsten
on 12 Nov 2025
Let's ignore the fifth differential equation in your code for a moment.
Then you set up code for the differential equation
y'''' = 1/(1+1/b) * (M*y' - y*y'' - L*(1-y'^2))
What are the four boundary conditions you want to impose for this equation (thus most probably 4 out of the 5 you set in your code) ?
residual=[y0(1); y0(2); y0(3)-1; yinf(2); yinf(3)];
After you've selected these 4, the fifth differential equation needs a condition that involves y(5), either at x=0 or x=Inf.
More Answers (0)
See Also
Categories
Find more on Boundary Value Problems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!