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 天)
显示 更早的评论
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 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!