LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Cleaning up a bode plot

Solved!
Go to solution

I am developing an application to test hardware components my colleague designed.

 

My application can read signal streams from the hardware and log the data in a file. Additionally, I can command the hardware to perform a frequency sweep on one of its input signals. Thus, I have the ability to log an input signal's frequency sweep as well as a corresponding output signal.

 

I can then do two things with the file:

  1. Read the log file and play back the signals on a strip chart. I have low-pass filters selectable to reduce noise on the raw data, if necessary.
  2. Read the log file of a frequency-swept signal, perform a transfer function on two selected signals, and plot the resulting data on a magnitude-v-freq, and a phase-v-freq log-scaled graph, aka Bode plots.

My issue is that my Bode plots are sometimes noisy, and I don't know how I should go about cleaning them up.

 

Here is an example:

bode.png

 

I know the frequency-swept input signal was noisy itself, so I thought to run it through a low-pass filter before plotting, but it did not appear to make any change.

 

I've also seen all the CVI curve-fitting options, but I'm not knowledgeable in whether or not these would make any sense, especially for the phase-v-freq graph, as its shape is indeterminate.

 

Can anybody nudge me in the correct direction? I'm sure there's information I am not providing as well.

0 Kudos
Message 1 of 4
(5,966 Views)

Hi apbenedetti, 

 

Are you filtering your data when acquiring with an external filter?

Rachel M.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(5,935 Views)
Solution
Accepted by topic author apbenedetti

Hi Rachel,

 

For the example I provided, the input signal is "raw" unfiltered data. What it actually is is a forced low voltage Sine wave, which is summed with the actual signal on that particular channel on the hardware (which is some low voltage white noise). For the purpose of our testing, we are using spare input and output channels, and the output channel is simply the input channel put through a low pass filter. We see a phase-shifted low-noise (smoothed) sine wave for the output.

 

 

 

After a long discussion with my colleagues, we think we know where we went wrong with this example.

 

As I mentioned, my application commands the hardware to do a frequency sweep. This was to replicate what the signals appeared like when my colleague uses his commercial frequency response analyzer hardware (Venable), which we are ultimately trying to replace with my application. How I had this set up was the input signal would spend N cycles of a sine wave at frequency f = Fstart, then f would increase by percentage P for N cycles until f = Fmax. N and P would remain constant.

 

We realized that if we kept N constant, we would not be collecting enough data at higher frequencies, which probably accounts for a lot of the noise at the higher frequencies due to the poor S/N ratio of the input signal. We think this could help clean up the plot, but we might still have a fundamental issue with how we were trying to do the TransferFunction.

 

I logged the entire file, would extract the entire input and output signal, and perform the transfer function on 2 single arrays of the entire data. I believe we have come to realize that the error in this method is that while the signals (in the time domain) appeared to be replicating the Venable, the Venable would analyze each individual step of f, and produce a data point for the Bode plot. We now believe this is how the CVI TransferFunction function should be utilized. That or, by instead providing a complex signal (y = sin(f0) + sin(f1) + sin(f2) + ... + sin(Fmax)). This would be too resource-heavy for our hardware.

 

If anybody can confirm if this is the correct way to use the TransferFunction function, it would be much appreciated...

0 Kudos
Message 3 of 4
(5,905 Views)

@apbenedetti wrote:

the Venable would analyze each individual step of f, and produce a data point for the Bode plot.


To clarify...

 

The Venable performs a transfer function on the signal at a particular frequency after collecting enough data. It then produces the data point for that frequency for the Bode plot. Next, it drives the input channel to change its frequency, and collects/analyzes that data to produce the next plot, moves to the next frequency, and so on.

 

So the Venable performs the transfer function one frequency at a time, but if viewing the signals in real time, this would appear as a frequency sweep, which we replicated. The important distinction is that the Venable performs the transfer function multiple times. We made the assumption that the CVI TransferFunction function could take in the entire frequency sweep and math it out.

0 Kudos
Message 4 of 4
(5,901 Views)