LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the frequency response of a Filter over a specified frequency range

Hi,

I'm trying to convert my professor's lab book from MATLAB into LABVIEW. To demostrate the various properties of the DTFT to students, the lab book plots the frequency responses of various FIR filters.

Right now I'm using DFD Get Freq Response (Digital filter design toolbox) to calculate the response over a range of requencies (ex: 256 points from -1Hz to 1Hz). My inputs to the DFD VI are vectors of filters coefficients and a vector of all the frequency points at which i want the response (in Hz).

what concerns me is that the output graphs are sometimes vastly different than the MATLAB counter part. (if anyone is familiar with matlab, the function i'm using there is freqz(num,den,w).)

so i guess if anyone can point me to another VI that can accomplish the same thing as the MATLAB function freqz() (calculate freq response of a FIR/IIR filter over a user defined frequency range), it would be great.

thanks a lot,

Yang

attatched is an example of how i'm using the VI.
0 Kudos
Message 1 of 4
(3,420 Views)
Hi YZ,

What you are trying to accomplish sounds very interesting. Using LabVIEW instead of MATLAB has its strengths and weaknesses, but for teaching purpose LabVIEW has obvious advantages in its intuitive dataflow environment.

However, LabVIEW and MATLAB doesn't share all the same functions, so there might be cases where a simple function in MATLAB is equivalent to code with multiple functions in LabVIEW. This might be the case for the MATLAB freqz function.

You mention that when using the DFD Get Freq Response, the "output graphs are sometimes vastly different than the MATLAB counter part." Please let me know what you mean with "different". If possible, please provide a screenshot of a MATLAB graph showing the expected behavior, and the result from LabVIEW.

With this added information, I should be able to give you some valuable results.

Thanks!
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 2 of 4
(3,401 Views)
Hi Philip,

thanks for your reply. since my initial post, i have figured out the reason behind the matlab / labview differences.

for most of my plots, i didn't realize that the default setting on DFD Get Freq Response was in dB. having fixed that, there was only one plot left that didn't come out the same as matlab.

it involved a demostration of the frequency shifting property of the DTFT. i multipied my coefficients by a complex exponential and fed the new filter into DFD Get Freq Response, expecting a set of shifted responses. however, the magnitude output was that of a cosine modulated signal. that confused me a great deal, and started me on this quest for answers which included this forum. in the end, i was refered to some people by my professor's contact at NI. they told me that DFD Get Freq Response does not take complex arguments. so clearly taking only the real part of my input would result in a cosine output.

anyways, i managed to side steped this, and all is well.


Cheers,

Yang Z.
Message 3 of 4
(3,391 Views)
Hi Yang,

Thank you for keeping me updated on your progress. I'm very excited that you were able to get it to work. In case you run into other issues when converting the book material from MATLAB to LabVIEW, don't hesitate to post a question here on the forum.

Good job - have fun!
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 4 of 4
(3,386 Views)