LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Curve Fitting Of a Frequencie Response

Hi everybody

 

as you can see from the title i have to create a polynomial curve fitting of a frequencies response curve; i attached a .vi project where is possible to find the frequencies and phase response of two signal that rapresent a DUT i have to study. In the upper one i find the frequencie response who is similar to a low-pass filter; now i have to fit that curve and find the polynomial expression (math formula) who describe that curve.. i try to find a solution but it's not working..

could someone suggest where the project is wrong??

 

Thank you 

Nigeltorque
0 Kudos
Message 1 of 15
(3,324 Views)

1. Did you look at the error out from the fitting VI?  It indicates that both input arrays must be the same size. Your X input is the FRF Magnitude (which should probably be the Y input) and the Y input is empty.  This cannot fit anything.

2. Why do you choose a 4th order polynomial?  The curve matches two straight lines better than any higher order polynomial.

3. What is the purpose of the fitting? What are you going to do with the fitted polynomial?

 

Lynn

0 Kudos
Message 2 of 15
(3,320 Views)

Note that you have lowpass filtered the sample with a cutoff of 350 Hz and then looked at the frequency response, which gives you a lowpass response with a cutoff of 350 Hz! You are measuring the filter, not your signal. Also, fitting routines work best when you fit a function whose form matches the data as closely as possible. If you know that the response will look like a lowpass, use that kind of function with variable parameters and do a fit to that.


Richard

0 Kudos
Message 3 of 15
(3,314 Views)

Others have pointed out some fundamental flaws in your overall algorithm design, but let's assume you want to blindly fit the frequency response to a polynomial.

 

All you need is look at the online help to see how to use the functions. Here is a quick draft. Makes sense?

0 Kudos
Message 4 of 15
(3,305 Views)

Thank you for reply

 

I just want to specify that:

 

1) the signal simulation vi and the filter it's to simulate the response of a DUT; in fact i have to study the the linear behaviour of a vacuum-tube amplifier and for now, i just need a frequency and phase response to prepare the simulation in labview.

 

2) once i have my frequencie response i have to fit that curve and find math formula of that curve because this formula rapresents the transfer function of the linear component of my DUT; the goal of the fit is to find the transfer function of the linear component of my DUT

 

3) i am going to follow your suggest and see if i can solve the problem

Nigeltorque
0 Kudos
Message 5 of 15
(3,287 Views)

Thanks for your message altenbach..

 

it seems to work.. i just wonder what's on the X input of the Polynomial Fit. vi :D.. i'am going to study that For Loop..

 

 

Nigeltorque
0 Kudos
Message 6 of 15
(3,274 Views)

nigeltorque wrote:

it seems to work.. i just wonder what's on the X input of the Polynomial Fit. vi :D.. i'am going to study that For Loop..



Each of your y points has a corresponding x value. The output cluster from the function contains (top to bottom) xo, dx, and [y]. To generate the explicit array of x values, you need to use a FOR loop and create an array with equally spaced values starting from x0 and a spacing of dx. My loop does exactly that. 😉

0 Kudos
Message 7 of 15
(3,268 Views)

yes, that's right altenbach! Now i understand..

 

i made another step in my projest.. it's very simple.. but the solution i find it's quit strange i think!

i just take the same signal, normalize to 1 and then i calculated the reciprocal; al last i fit the curve and find the math expression..

what i expect is a curve that is the opposite oh the first one but i find a curve that have a very hard knee, i think the curve is to hard in fact is impossible to fit; sometimes i find nothing from the fit operation, sometimes i find just vertical fit data (i am sure it's an error)..

Do you know what's wrong in this project?? 

Maybe the input signal is to strange?? 

 

Advices are welcome..

Nigeltorque
0 Kudos
Message 8 of 15
(3,254 Views)

By scaling between 0 and 1, then taking 1/x, you last values (which are very close to zero) will be very close to infinity, thus dominating the fit.

 

If you would take a 1000 point subset after the 1/x (or do a "+1" right before it), the fit will succeed because you eliminate the numerical problem.

 

Still, I don't understand the point of your exercise. A polynomial is probably not the right function anyway, and even if you get a reasonable fit, the polynomial coefficient don't mean much. Don't you have an exact mathematical model with meaningful parameters?

0 Kudos
Message 9 of 15
(3,248 Views)

Here is an example of using the nonlinear curve fitting to fit a curve of the proper form. I reduced the lowpass order to 1, then put in a formula for a first-order RC lowpass into the L-M fitting routine. You could do the same thing with a more complicated function for a higher-order response. It is also important to turn off the log scale for the amplitude in the frequency response because the logarithm overemphasizes the small signals. If you leave dB On you would have to fit the log of the response function and the results are not good.


Richard

0 Kudos
Message 10 of 15
(3,241 Views)