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.
Solved! Go to Solution.
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.
If this is not what you were looking for, please explain the purpose of your smoothing.
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?
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.