help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plotting the frequency response of a filter in "real" Hz


From: Maynard Wright
Subject: Re: Plotting the frequency response of a filter in "real" Hz
Date: Thu, 21 Apr 2016 16:09:40 -0700
User-agent: KMail/4.13.3 (Linux/3.16.0-30-generic; KDE/4.13.3; i686; ; )

On Wednesday, April 20, 2016 09:44:42 PM Guilherme Ritter wrote:
> Hi everyone.
> 
> I've just started in filter design at college and I'm learning to use
> Octave for it. I want to see the frequency response of filters I design.
> I've managed to find code on the internet, but the output's x axis is in
> radian frequency. I'd like it to show "actual" Hz. For example, if the
> cutoff frequency is 5,5 kHz, I'd like for it to be represented in the
> plot's x axis at 5500 or 5,5.
> 
> I've searched a lot but couldn't find anything, only some solutions that
> work in MatLab but not in Octave. At college, I'm using Octave 4.0.0,
> packages control 3.0.0 and signal 1.3.2, Windows 7 Enterprise x64. At home,
> all the versions are up to date, Xubuntu 14.04 x64.
> 
> I've found the code here:
> https://ccrma.stanford.edu/~jos/fp/Example_LPF_Frequency_Response.html
> 
> Can I use Octave's functions to get that plot the way I want it?
> 
> Thanks in advance.


If you are plotting using

plot(w,abs(H));

as in the first example in the code you reference,  w is in radians per second. 
  
You can create another vector that contains corresponding frequencies in Hz 
and then use it in the plot:

fHz = w / (2 * pi);
plot(fHz,abs(H));

You will be using w in all the calculations and fHz just for the plotting.

Maynard Wright




reply via email to

[Prev in Thread] Current Thread [Next in Thread]