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!