02-09-2017 08:13 AM
Hi Guys,
I have this silly question.
I tried to do a fitting for Lorentzian with a1+(a2/19.744328)/(x^2+a3^2) formula. If i converted the power to db, the fitting was done nicely. But when using the power (in log), the fitting gone very wrong.
*db=10log(power)
My objective is to get a3 (Fc, corner frequecy) of the power spectrum or half power frequency.
The main question is, how can i get the fitting for power spectrum?
(the fitting might take a while to process)
02-09-2017 08:53 AM
Your problem is related to the high (dynamic) range of values that your Y array can take when not represented in dB.
Your fitting algorithm assumes that all values are equally weigthed is not otherwise specified. This means that fitting errors for very small power values are relatively more important.
Here is what you get if you specify your weighting function as the reverse of your Y input array.
This is just a simple approach, you can probably achieve better results by tweaking your weight array.
02-10-2017 02:00 AM
Local DSP.
Yeah, it does make it fit I get a gist of what i'm facing now.
Hovewer, is there any way for it to shape like this fitting?
I tried a lot of weighting tweaking. but didnt find the fit one.
02-10-2017 02:50 AM
Why don't you just fit as you do in the dB world and convert the result back to Power?
02-10-2017 03:07 AM
I think that it is important to separate the concept of calculating (fitting) using a log scale (dB) and displaying your result using a log scale (Power). You fitting function will have some restrictions in the way it can 'look' according to your model description formula. For example if you display the result of the Power fitting using the simple 1 / Y weighting method using a linear Power scale (and zoom a little on the X-axis) you get a function that has the same 'look' as your fitting function in the dB world.
That function gets obviously distorted when displayed using a log power scale.
So I am not sure you can expect to find the shape you are looking for in your log-power display using that fitting model description.