Syntax of res-function for bvp4c
이전 댓글 표시
function res = bcfun(ya,yb,I)
ya(1)=850;
yb(1)=303;
ya(3)=850;
yb(3)=303;
ya(5)=r_cu; %constant
yb(5)=r_cu-((rho_p_T_c/A_p+rho_n_T_c/A_n)-(rho_p_T_h/A_p+rho_n_T_h/A_n))*L; %all constants
V_tho=2*I*(r_cu+(rho_p_T_c/A_p+rho_n_T_c/A_n)*L)-(alpha_p_T_h-alpha_n_T_h)*T_h-(alpha_p_T_c-alpha_n_T_c)*T_c; %all constants except for parameter I
res = [ya(1)-yb(1)
ya(3)-yb(1)
ya(2)
ya(4)
ya(5)
yb(5)
ya(6)
yb(6)-V_tho];
end
댓글 수: 25
Torsten
2018년 11월 13일
If you want to set yi at x=0 to a value "v", res = ya(i) - v.
If you want to set yi at x=L to a value "v", res = yb(i) - v.
Justin Riggio
2018년 11월 13일
Justin Riggio
2018년 11월 13일
Torsten
2018년 11월 13일
So y(2) at x=0 is a function of y(1) at x=1 and y(4) at x=0 is a function of y(3) at x=1 ? This is only possible if an explicit value for y(2) at x=0 or y(1) at x=1 is prescribed as a second boundary condition for the first case and if an explicit value for y(4) at x=0 or y(3) at x=1 is prescribed as a second boundary condition for the second case.
Justin Riggio
2018년 11월 13일
편집: Justin Riggio
2018년 11월 13일
Torsten
2018년 11월 13일
If x=1 is the right boundary point, you can set
res = ya(2)-k_p_t_h*A_p*(T_h-yb(1))
But ya(2) or yb(1) must be specified somewhere else as explicit boundary condition, e.g.
res = ya(2) - 20
If x=1 is not a boundary point, the condition cannot be set in bvp4c.
Justin Riggio
2018년 11월 13일
Justin Riggio
2018년 11월 14일
편집: madhan ravi
2018년 11월 15일
Torsten
2018년 11월 14일
Call bvp4c like
sol = bvp4c(@odefun,@(ya,yb)bcfun(ya,yb,solinit),solinit);
to make "solinit" available in "bcfun".
Justin Riggio
2018년 11월 14일
Torsten
2018년 11월 14일
Did you also change the argument list of the bcfun-routine itself:
function res = bcfun(ya,yb,solinit)
?
Justin Riggio
2018년 11월 14일
Torsten
2018년 11월 15일
Then
sol = bvp4c(@odefun,@(ya,yb,l)bcfun(ya,yb,l,solinit),solinit);
Justin Riggio
2018년 11월 15일
Torsten
2018년 11월 15일
Try if it works if you use the line
global solinit
in the program where you call bvp4c as well as in bcfun.
Justin Riggio
2018년 11월 15일
I think the error before arises because you did not initialize your parameter l within the solinit construct.
Take a look at the example
"Compute Fourth Eigenvalue of Mathieu’s Equation"
under
especially the definition of "solinit".
Justin Riggio
2018년 11월 15일
Justin Riggio
2018년 11월 15일
Justin Riggio
2018년 11월 15일
madhan ravi
2018년 11월 15일
@Justin i edited all your comment next time format it properly so that it's easy to read
Justin Riggio
2018년 11월 15일
Justin Riggio
2018년 11월 15일
Justin Riggio
2018년 11월 15일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!