Solving Numerical Integral Implicitly
Show older comments
Hi everyone;
I am working on constant temperature hot-wire anemometry. So I am using second order diff. egn (conduction eqn).
I solved analytically main eqn and found temperature distribution ;
f=0.09;
b=0.0044;
q=3.73E-9;
L=1;
Tw=250;
Tam=27;
T(x)= 2*C1*cosh(x*((f-b*g)/q)^0.5)+g/(f-b*g)
Then C1 has to be determined from boundary condition.
T(+L/2)=0
T(-L/2)=0
Then I found C1 depends on g. Because g is implicitly unknown.
syms c g
solve(2*c*cosh(0.5*(0.09-0.0044*g)/3.73*10^-9)^0.5+g/(0.09-3.73*10^-9*g)==0,c)
g can be determined from constant temperature condition.
1/L*int(T(x)dx,-L/2,L/2)=Tw-Tam
All things considered, my all code is;
clc;
clear all;
f=0.09;
b=0.0044;
q=3.73*10^-9;
L=1;
Tw=250;
Tam=27;
syms c g
c=solve(2*c*cosh(L/2*(0.09-0.0044*g)/3.73*10^-9)^0.5+g/(0.09-0.0044*3.73*10^-9)==0,c)
syms x
z=int(2*c*cosh(x*((f-b*g)/q)^0.5)+g/(f-b*g),x,-L/2,L/2);
g=solve(z==L*(Tw-Tam),g)
g
This condition should give,after performing the integral, an algebraic equation for g. But g (result) is zero . It alyaws gives g as a zero. why ? My Matlab skills are not enough for it. Then I want to plot temperature dist. T(x) . x can be divided 100 parts in length L to plot temperature distribution. Please help for code. Thank you,
Yusuf
Accepted Answer
More Answers (1)
yusuf
on 4 Feb 2014
8 Comments
Walter Roberson
on 4 Feb 2014
When I substitute in that g, I get the expression evaluating to about -5 * 10^132
It is necessary to use a higher Digits setting as round-off error is crucial in this expression.
The expression has a singularity at g = 225/11 (about 20.54) at which point the denominator goes to 0. My probing appeared to show that the expression as a whole was negative on both sides of 225/11 but looking more closely I see that there is a zero crossing at approximately
20.45391002416497839752127043955070423654750203048625970671478823191317020198663176935360949566221927656712507551824472117488414858009464880684375718019927156153876042420949034484336928538349330556637734407970792045428171493510222258582752843682333646987930
yusuf
on 4 Feb 2014
yusuf
on 4 Feb 2014
Walter Roberson
on 4 Feb 2014
20.45391002416498 will be off by about 1.6/1000 but that's not so bad compared to the slope in that area.
yusuf
on 4 Feb 2014
Walter Roberson
on 4 Feb 2014
It will be later: it is amazing how tiring it is to have a physiotherapist work on your back.
yusuf
on 4 Feb 2014
Walter Roberson
on 10 Feb 2014
You need to
subs(T,'g',g)
in order to get the T with g replaced.
Categories
Find more on Function Creation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!