Trial and error problem
조회 수: 12 (최근 30일)
이전 댓글 표시
Dear Matlab Community Members
My objective is to find the values a, b, and c. of the following equation:
log(m)=log(a)+(b/(T-c))
I have three values of m & T
m=0.0701 & T=293.65
m=0.0262 & T=313.15
m=0.00433 & T=373.15
I want to know what is the best code or technique to find these values.
Thank you very much
댓글 수: 8
the cyclist
2023년 1월 26일
편집: the cyclist
2023년 1월 26일
How did you choose that function for the fit? It seems like a poor one, because of the singularity that will happen when T==c.
c = 280;
T = 260 : 380;
f = @(t) 1./(t -c);
plot(T,f(T))
Even if your values of T are strictly greater than c, (the "critical" temperature), this behavior will make it difficult for any algorithm to fit it.
One can try (e.g. with fitnlm), but MATLAB spits out warnings about overparameterization, and the fit is not good.
답변 (1개)
Torsten
2023년 1월 26일
편집: Torsten
2023년 1월 26일
The results are not convincing, but that's the way to go with three data points.
fun1 = @(x)[0.0701-x(1)*exp(x(2)/(293.65-x(3)));0.0262-x(1)*exp(x(2)/(313.15-x(3)));0.00433-x(1)*exp(x(2)/(373.15-x(3)))];
fun2 = @(x)[log(0.0701)-(log(x(1))+x(2)/(293.65-x(3)));log(0.0262)-(log(x(1))+x(2)/(313.15-x(3)));log(0.00433)-(log(x(1))+x(2)/(373.15-x(3)))];
x0 = [2 1 450];
x = fsolve(fun1,x0)
fun1(x)
x = fsolve(fun2,x0)
fun2(x)
댓글 수: 5
Torsten
2023년 1월 27일
편집: Torsten
2023년 1월 27일
Isn't the form of the equation usually
m = 10^(A-B/(C+T))
where T is in degreeC ?
Thus
log10(m) = A - B/(T+C)
where log10 is not the natural, but the decadic logarithm and T is temperature in degreeC ?
m1=0.0701;
T1=293.65-273.15;
m2=0.0262;
T2=313.15-273.15;
m3=0.00433;
T3=373.15-273.15;
syms a b c
eqns = [a-b/(T1+c)== log10(m1), a-b/(T2+c)== log10(m2), a-b/(T3+c)==log10(m3)];
S = vpasolve(eqns,[a b c])
double(subs([a-b/(T1+c)- log10(m1), a-b/(T2+c)- log10(m2), a-b/(T3+c)-log10(m3)],[a,b,c],[S.a,S.b,S.c]))
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!