problem in plotting data
Afficher commentaires plus anciens
Goodmorning,
I am doing a fit with a complex function: the code seems to work correctely but I cannot plot the data.
Do you have suggestion about what the problem is?
I attach the code I am working on and the data.
close all
clear
clc
load 'f_B100_PEGNA_t30_bisSC.txt'
f_B100_PEGNA_t30_bisSC;
f=f_B100_PEGNA_t30_bisSC(:,1);
yR=f_B100_PEGNA_t30_bisSC(:,6);
yI=f_B100_PEGNA_t30_bisSC(:,7);
Y=yR-1i*yI;
DER=yR.*0.01;
DEI=yI.*0.01;
DE_tot=DER+1i*DEI;
weightR=1./DER;
weightI=1./DEI;
weightT=1./DE_tot;
fit_fun=@(r,f) abs(r(1))+abs(r(2))./(1+(1i*f*2*pi*r(3)).^(abs(1-abs(r(4))))).^(r(5));
fit_funw=@(r) norm(weightR.*real(fit_fun(r,f)-Y)+1j*weightI.*imag(fit_fun(r,f)-Y));
r0=[1,1,1,1,1];
r=fminsearch(fit_funw,r0);
r=r(:)
figure(1)
loglog(f,yR,'o',f,real(fit_fun(r,f)))
figure(2)
loglog(f,yI,'o',f,-imag(fit_funw(r)))
Thank you all!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Annotations 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!

