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);
0 件のコメント
採用された回答
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 件のコメント
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 Center および File Exchange で Boundary Conditions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!