Question

I am working on constant temperature hot-wire anemometry in Matlab. So I am using a second order differential equation (conduction equation).

I solved the main equation analytically 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 a boundary condition:

T(+L/2)=0
T(-L/2)=0

Then I found C1 as a function of 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)

This condition should give,after performing the integral, an algebraic equation for g. But the resultant g is zero. It always returns g as a zero. Why? My Matlab skills are not enough for this. I then want to plot the temperature distribution T(x). x can be divided into 100 parts of length L to plot the temperature distribution.

Was it helpful?

Solution

I don't get zero (assuming that I have your equations correct now). Perhaps you're not substituting in your values properly. You can use the subs function to do this automatically:

f = 0.09;
b = 0.0044;
q = 3.73e-9;
L = 1;
Tw = 250;
Tam = 27;

syms c x g
T = 2*c*cosh(x*((f-b*g)/q)^0.5)+g/(f-b*q);
c = solve(subs(T,'x',L/2)==0,c);
z = simplify(int(subs(T,'c',c),x,-L/2,L/2));
g = solve(z==L*(Tw-Tam),g)

which returns

g =

20.135660961656472105004196502187

You can use double to convert this to floating-point. And you can check that this value of g does indeed solve your equation:

eval(subs(z-L*(Tw-Tam),'g',g))

which returns 0.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top