How to solve a non linear problem with bv4c?
이전 댓글 표시
I have to solve the following heat conduction steady-state non-linear problem using the function bvp4c in matlab:
λ∙(1/r)∙d/dr(r∙dT/dr)+5∙10^6-100T^2=0
with the boundary conditions: T(r1)=T1=300K, T(r2)=T2=350K
r1=0.8 m ; r2=1 m λ=400 W/(m⋅K)
How can I write the code?
답변 (1개)
Torsten
2017년 5월 9일
Your equation reads
λ∙(T''(r)+T'(r)/r)+5e6-100*(T(r))^2 = 0.
or - rewritten as a system of 1st order equations -
T1' = T2
T2' = (100*T1^2-5e6)/λ - T2/r
Can you take it from here ?
Best wishes
Torsten.
댓글 수: 3
Arianna Serpi
2017년 5월 9일
Torsten
2017년 5월 9일
function main
r1=0.8;
r2=1;
T1=300;
T2=350;
lambda=400;
n=31;
r=linspace(r1,r2,n);
solinit = bvpinit(r,@(r)guess(r,r1,r2,T1,T2));
sol = bvp4c(@(r,T)twoode(r,T,lambda),@(Tl,Tr)twobc(Tl,Tr,T1,T2),solinit);
T=deval(sol,r);
plot(r,T(1,:))
function dTdr = twoode(r,T,lambda)
dTdr=[T(2);(100*T(1)^2-5e6)/lambda-T(2)/r];
function res=twobc(Tl,Tr,T1,T2)
res=[Tl(1)-T1;Tr(1)-T2];
function T0=guess(r,r1,r2,T1,T2)
T0(1) = T1*(r-r2)/(r1-r2)+T2*(r-r1)/(r2-r1);
T0(2) = (T2-T1)/(r2-r1);
end
Best wishes
Torsten.
Arianna Serpi
2017년 5월 9일
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!