After running the code for (f ') w.r.t x , we need to draw( f ' ) w.r.t G (in X-axis) while varying n=0, 0.5, 1

조회 수: 1 (최근 30일)
function main
Pr=1;K=1;L=-1;S=0.1;
n=input('n=');
a=linspace(0,6,100);
G=linspace(0,7,100);
solinit=bvpinit(a,G,[0 1 0 1 0 0 1]);
sol=bvp4c(@ode,@bc,solinit);
xint=a;
sxint=deval(sol,xint);
function res=bc(ya,yb,G)
res=[ya(1)-S; ya(2)-L; ya(4)+n*ya(3); ya(6)-1; yb(2)-1; yb(4); yb(6);];
end
function dydx=ode(x,y,G)
dydx=[y(2); y(3);(y(2)^2-1-y(1)*y(3)-K*y(5)-G*(1-y(2)))/(1+K);y(5);2*(y(2)*y(4)-y(1)*y(5)+K*(2*y(4)+y(3)))/(2+K);y(7);-Pr*y(1)*y(7)];
end
plot(xint,sxint([2],:),'Linewidth',2); %for f'
xlabel('\eta');
ylabel('f^\prime');
hold on
end
ERROR occurs as:
n=0
Error using bvparguments (line 108)
Error in calling BVP4C(ODEFUN,BCFUN,SOLINIT):
The derivative function ODEFUN should return a column vector of length 100.
Error in bvp4c (line 130)
bvparguments(solver_name,ode,bc,solinit,options,varargin);
Error in (line 7)
sol=bvp4c(@ode,@bc,solinit);

채택된 답변

Walter Roberson
Walter Roberson 2019년 2월 21일
your G is length 100. You pass it to bvpinit so matlab knows that your ode function works with 100 derivatives. but your ode only returns 7 rather than 100.
I notice that your upper bound for G is 7, the same number as the derivatives calculated . I wonder if perhaps you used linspace incorrectly .
  댓글 수: 13
MINATI
MINATI 2019년 2월 27일
Can I run pde toolbox, means I have to learn how to run this first or what to do?
Walter Roberson
Walter Roberson 2019년 2월 27일
You need the PDE Toolbox instead of what you are doing. You will have to learn how to use it.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Boundary Conditions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by