Evaluating a function using kramers-kronig relation
Afficher commentaires plus anciens
Hello , I have this function :

and want to evalute the function nR using this integral (cauchy principal value)

The problem is this integral have 2 variables (one remains constant during the integration) , I spend a lot of time figuring it out and couldn't (I'm relatively new to matlab) , I would be happy if someone provides a code on how to evaluate nR as function for w
Réponses (2)
Dyuman Joshi
le 2 Mai 2023
Modifié(e) : Dyuman Joshi
le 4 Mai 2023
You can use symbolic integration (Note - Requires Symbolic Toolbox)
As you have not provided the value of P, I've defined it as a symbolic variable. You can either use the value of P directly by simply defining it, or use subs to substitute the value in the final expression.
syms w x
val = 2*sym(pi)*10^11;
Tau = 0.25*val;
w0 = 500*val;
K(w) = Tau^2/(2*sym(pi)*((w-w0)^2+Tau^2));
nr(w) = 1 + 2*int(x*K(x)/(x^2-w^2), x, 0, Inf, 'PrincipalValue', 1)/pi
2 commentaires
Torsten
le 2 Mai 2023
P stands for "principal value" of the integral.
Dyuman Joshi
le 3 Mai 2023
Modifié(e) : Dyuman Joshi
le 4 Mai 2023
Ah, I see, thanks for the info, I was not familiar with this syntax. I have edited my answer.
syms omega omega0 Omega Gamma real
kappa(omega) = 1/(2*pi) * Gamma^2/((omega-omega0)^2 + Gamma^2) ;
nR(omega) = 1 + 2/pi*int(Omega*kappa(Omega)/(Omega^2-omega^2),Omega,0,Inf,'PrincipalValue',1);
vpa(subs(nR(1.2),[Gamma omega0],[0.25*1e11*2*pi,500*1e11*2*pi]))
Catégories
En savoir plus sur Calculus dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
