How to use a Digamma function with a complex argument.?
Show older comments
Hello, I'm trying to fit a curve with some experimental values. But I cant solve the equation with complex argument in the Digamma function (psi).
if true
% code
end
h=6.62606957e-34;
f0=5.45e9;
kB=1.3806488e-23;
%T0=200e-3; %in kelvin
T0=130e-3;
x=0.5+((h*f0)/(2*pi*1i*kB*T0));
g2=real(psi(sym(x)));
T=200e-3;
x=0.5+((h.*f0)./(2*pi*1i*kB.*T));
g1=real(psi(sym (x)));
delf0=(f-f(7))./f(7);
freq=@(b,x) (b(1)/pi)*(log(x./T0)-(g1-g2));
b0=7.8893e-05;
beta=nlinfit(T,delf0,freq,b0);
---------------- I get the follow error ----------------
if true
% code
end
Undefined function 'isfinite' for input arguments of
type 'sym'.
Error in nlinfit (line 242)
if funValCheck && ~isfinite(sse), checkFunVals(r); end
Error in f0_temp_fit (line 26)
beta=nlinfit(T,delf0,freq,b0);
What is wrong with the code ? PS: I have not included the data acquisition part in this code above.
Thanks, /C
1 Comment
Star Strider
on 15 Aug 2015
Some problems:
- Don’t use sym. There is no reason for it in your code;
- Your ‘g1’ and ‘g2’ are exactly the same, so (g1-g2)=0;
- ‘T’ has to be a vector the same size as ‘delf0’.
Answers (0)
Categories
Find more on Gamma Functions 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!