Can somebody please guide how to solve this implicit relation for T under different values of t, i have tried using solve, fsolve and fzero but not getting correct answer

1 回表示 (過去 30 日間)
syms T %temperature
c=2010; To=70; Tr=200;
sigma=0.119e-10; epsilon=1; rho=0.101;
H=1; %assumption
for t=0:10;
fnc=(sigma*epsilon/rho/c/H*t)+((1/4/Tr^3)*(log((Tr-T)*(Tr+To)/(Tr+T)/(Tr-To))+(2*atan(T/Tr))));
solve (fnc==0, T)
end
  2 件のコメント
Roger Stafford
Roger Stafford 2016 年 4 月 10 日
It is unlikely that 'solve' can solve this equation. Please show us what you have tried with 'fzero'. That is your best bet. It will require that you give an initial estimate for each value of t. That may be the most difficult part. I suggest making a plot of the value of your expression as a function of T to see roughly where it crosses zero for each different value of t.
Incidentally, what happened to the term "2*arctan(To/Tr)" in your expression?
Anees khan
Anees khan 2016 年 4 月 10 日
Thanks Roger for ur reply and especially mentioning out the missing values. It turned out that the value of function had very slight variation with t, so i had to increase the t scale. However Matlab did solved the equation with solve function as well, by returning an approximate value. I really appreciate your input. Thanks

サインインしてコメントする。

回答 (2 件)

John BG
John BG 2016 年 4 月 10 日
Since there is only one t on the left of the equation:
c=2010; To=70; Tr=200;
sigma=0.119e-10; epsilon=1; rho=0.101;
H=1;
T=[-274:1:50]
t=rho*c*H/(sigma*epsilon)*((1/4/Tr^3)*(log((Tr-T)*(Tr+To)/(Tr+T)/(Tr-To))+(2*atan(T/Tr))))
plot(t);grid on
figure(2);plot(t,T)
figure(2);plot(t,T);grid on
if you try to visualize the function you try to zero, with the expression you used in the question,
T=[-274:.1:50]
t=[-50:.1:50]
[X Y]=meshgrid(T,t)
Z=(sigma*epsilon/rho/c/H*Y)+((1/4/Tr^3)*(log((Tr-X)*(Tr+To)/(Tr+X)/(Tr-To))+(2*atan(X/Tr))));
figure(3);surf(X,Y,Z)
MATLAB fills up Z with NaN.
But adding a dot, element wise division inside the log, and simplifying the quotient expression inside the log to a single / then:
T=[-274:1:50]
t=[-50:1:50]
[X Y]=meshgrid(T,t)
Z=(sigma*epsilon/rho/c/H*Y)+((1/4/Tr^3)*(log((Tr-X)*(Tr+To)./((Tr+X)*(Tr-To)))+(2*atan(X/Tr))));
absZ=abs(Z)
figure(3);surf(X,Y,absZ)
note:
1.- complex result, only plotting abs(Z)
2.- T=Tr asymptotic
3.- you are trying to find a zero of a really a function handling really small values, perhaps you may want to consider modifying the function to find where the asymptote crosses zero, that may be ~Tr, and then it all ends up simplified to t=0.
If you find this answer of any help solving your question, please click on the thumbs-up vote link,
thanks in advance
John
  2 件のコメント
Anees khan
Anees khan 2016 年 4 月 10 日
Thanks alot John. It turned out that the value of function had very slight variation with t, so i had to increase the t scale and imaginary answer was due to syntax error. Matlab did solved the equation with solve function as well, by returning an approximate value. I really appreciate your input. Thanks again
Anees khan
Anees khan 2016 年 4 月 10 日
syms T %temperature
c=2010; To=70; Tr=200;
sigma=0.119e-10; epsilon=1; rho=0.101;
H=.01; %assumption
for t=1:1000:100000;
fnc=(sigma*epsilon/rho/c/H.*t)+((1/4/Tr^3).*(log((Tr-T).*(Tr+To)./(Tr+T)./(Tr-To))+(2.*atan(To./Tr))-(2.*atan(T./Tr))));
kk=solve (fnc==0, T);
plot (t, kk,'b--o')%
hold on
end
plot (t, kk)

サインインしてコメントする。


Walter Roberson
Walter Roberson 2016 年 4 月 10 日
For all of the t values in the range you show, 0 to 10, T is between 70 (exactly equal for t=0) and 71. If you increase t then T will slowly increase. For any given T value less than 200, there is a corresponding t value. The asymtope is at T = 200 as t goes to infinity, and you would require extended precision to solve beyond about t = 10^7
  1 件のコメント
Anees khan
Anees khan 2016 年 4 月 10 日
You are very right Walter, the variation of T was very slow w.r.t. t and had to increase the t scale by several orders. Thanks for your reply. Appreciated!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by