From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Interpolation filter (FIR) on a Nyquist sampled signal.

Solved!
Go to solution

Hi there, any help is appreciated:

 

When I generate a tone, say 4000 Hz Sin and sample it at Nyquist I get a linear interpolation. 

I've been experimenting on how I could regenerate a more accurate representation of the original 4000Hz sine wave, instead of the linear 'triangle' wave that a direct connection would show.

So far I've had no luck in interpolation except using the 'Align and Resample' function, where a higher resample allows for FIR interpolation, but this only works if i resample the wave at much higher than Nyquist. 

If anyone could advise me on this matter, with advice on how to 'smooth' my triangle wave into the original sine wave i put in.

 

I've attached my code.

 

Many thanks

 

0 Kudos
Message 1 of 4
(2,762 Views)

I think we need to clarify the concepts here. When you sample your 4 kHz tone at 10 kHz you only get 2.5 samples per period. When you graph it it may look interpolated using linear interpolation so you see a 'triangle' type of shape, but you still only have five valid samples for every two signal periods.

 

If you want to achieve a better graphing of your signal you need more samples and that is exactly what the resample VI is doing. It returns your signal sampled at a higher rate, so more samples per period.

 

When a desktop oscilloscope performs for example a Sin(x)/x smoothing of the waveform, it is doing the exact same thing. The Sin(x)/x function (in a finite truncated version) is nothing but a special FIR filter case.

 

If you overlay the original and resampled waveforms (and change the plot attributes) you can see both the original samples and the smoothed plot.

 

billede.png

 

If this is not what you were looking for, please explain the purpose of your smoothing.

0 Kudos
Message 2 of 4
(2,729 Views)

Hi LocalDSP,

 

Thanks for your comments. So this suggests that when I am using the 'resample' VI, it is in fact preforming FIR interpolation on the waveform,with the re sample [resample interval] rate defining the accuracy/order of the interpolation.

Do you have the VI for that graph?

 

Thanks again

Watter

 

0 Kudos
Message 3 of 4
(2,726 Views)
Solution
Accepted by topic author Watter

Yes the resample VI interpolates your waveform to return a signal with the sample interval (dt) that you specified.

The resampling method uses an FIR filter (assuming of course that it is the method you've selected). If you select Linear Interpolation you'll get ... the 'triangle' waveform you see on your original graph.

 

The graph I showed is just displaying your two waveforms (pre-and post-interpolation). The original waveform plot has different plot properties as you can see on the legend. No interpolation and point style set to 'fat' point. Right-click on the legend to access the plot properties.

0 Kudos
Message 4 of 4
(2,722 Views)