Info

この質問は閉じられています。 編集または回答するには再度開いてください。

BVP4C is returning x and y output vecotrs that are different in length from the original x vector. Is there a way to fix the length of x ans y?

1 回表示 (過去 30 日間)
Saeid
Saeid 2020 年 8 月 21 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I would like to solve a set of BVPs with the starting x values (second line of the code below) in a vector of length 50, but when I check the solution the final vector has the length 99. Is there a way to fix the length of x (and consequently, y) from the start?
H0=2e-3; GG0=4e4; TT0=32; K0=1.7e-5; Pz=1e5;
x=linspace(1e-6,H0/2,50);
solinit = bvpinit(x, @guess);
sol=bvp4c(@bvpfcn,@bcfcn,solinit);
xx=sol.x; yy=sol.y;
function dydx=bvpfcn(x,y)
% y1=Txy(r), y2=u(r)
b2_4ac=GG0^2-4*K0*GG0*(y(1))^2;
tyy=(-0.5*(GG0-sqrt(b2_4ac)));
dydr=[Pz -(tyy/TT0)/(K0*y(1)*(tyy+GG0))];
%dydr=[Pz(ii) (y(1)/TT0)/(-K0*y(1)^2+tyy+GG0)];
end
function res=bcfcn(ya,yb)
res=[ya(1) yb(2)];
end
function g=guess(x)
g=[1e4 1e-2];
end

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by