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!