Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MATLAB - using freqz

  1. Oct 13, 2006 #1
    hey guys .
    i have this discrete signal : z/(z-(e^-2T))

    and i want to get a frequency response of it...

    i use the matlabe function : freqz

    but the problem is that it only plots up to the angular frequency of 1!!! i.e. its a normalized frequency...

    does anybody know how i can make it plot up to w =100 for example?
    i need to do this so i can compare it to my continuous signal and analyze any alising that may occur..

  2. jcsd
  3. Oct 13, 2006 #2
    Learn to use the function by typing "help freqz" at the prompt.
    You'd then see that FREQZ(B,A,N,Fs) will display the spectrum in the frequency axis scaled to the sampling frequency (Fs).
  4. Oct 14, 2006 #3
    thanks - i did try that first; this post was my second alternative.

    i kept changing the values of N and Fs but did not get the right results. something is missing - i was hoping somebody that knows matlab well could tell me.
  5. Oct 14, 2006 #4
    Well, what is the sampling frequency Fs? For N, try setting it to a big number, like 2^10, for better frequency resolution.
  6. Oct 17, 2006 #5
    please help

    sup doodle - okay i've played around some more but without achieving much success. I've attahed the frequency responses i got for my discrete signal with teo different sampling periods. As you can see, it only plots the normailized frequncey (upto 1rad/sec) but i really need it to plot upto at leat 100rad/sec(as with the continous signal frequency response) this is so i can observe any repetition of the sampled signal. hope you or some one can help me

    thanks very much

    Attached Files:

  7. Oct 17, 2006 #6
    Hmm... you need to understand that discrete-time signals do not appreciate the notion of sampling time. If you are convinced that your sampling frequency is 100Hz, then you should use "freqz(znum,zden,[],100)" instead.

    And please understand also that spectrums of discrete-time signals are periodic and what is shown (by freqz) is only one-half period of the spectrum. If you were thinking of looking at the spectrum beyond the 1Hz and expecting to find something other than what is contained in this one-half period, then you are gravely mistaken.
  8. Oct 17, 2006 #7
    i am well aware of the fact thet a frequncy responce of a sampled signal will be periodic....you seem to keep missing my point/dilema. I need to see these repetitions - i.e. i want to see the effect of my frequency response with various sampling periods. So i DO want a spectrum over 1Hz!! i will find something other! - i will be able to observe the level of severity of aliasing with different sampling periods!!!!!

    thanks anyway
  9. Oct 17, 2006 #8
    The DTFT of a system can be calculated from the transfer function using freqz. Define the numerator and the denominator of the transfer function in num and den. The command
    [H,Omega] = freqz(num,den,n,'whole');
    computes the DTFT for n points equally spaced around the unit circle at the frequencies contained in the vector Omega. The magnitude of H is found from abs(H) and the phase of H is found from angle(H). To customize the range for ohm, define a vector Omega of desired frequencies, for example Omega = -pi:2*pi/300:pi defines a vector of length 301 with values that range from -pi to pi. To get the DTFT at these frequencies, type

    H = freqz(num,den,Omega);
  10. Oct 18, 2006 #9
    Well okay, if you want to observe beyond the 1Hz, then do this:
    which gives a plot upto 3Hz with 1Hz as the sampling frequency, i.e., you'd be looking at three period of the spectrum.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook