Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
fdatool vs buttord and butter functions

Subject: fdatool vs buttord and butter functions

From: James Pau

Date: 20 Jan, 2010 10:51:03

Message: 1 of 4

Hi there,

I've made a Butterworth filter using the 'buttord' and 'butter' functions in MATLAB which gives me a desirable response. However, when I try to recreate the same filter using the fdatool so that I can generate a block for use in Simulink, the response is quite different (i've checked this on the same input signal).

Would anyone know the reason why this might be?

Thanks in advance,
James

Subject: fdatool vs buttord and butter functions

From: Wayne King

Date: 20 Jan, 2010 11:04:04

Message: 2 of 4

"James Pau" <the_mantis81@hotmail.com> wrote in message <hj6n6n$9q8$1@fred.mathworks.com>...
> Hi there,
>
> I've made a Butterworth filter using the 'buttord' and 'butter' functions in MATLAB which gives me a desirable response. However, when I try to recreate the same filter using the fdatool so that I can generate a block for use in Simulink, the response is quite different (i've checked this on the same input signal).
>
> Would anyone know the reason why this might be?
>
> Thanks in advance,
> James
Hi James, can you provide the specifics of how you are specifying the filter at the command line and in fdatool?

Thanks,
Wayne

Subject: fdatool vs buttord and butter functions

From: James Pau

Date: 20 Jan, 2010 21:00:22

Message: 3 of 4

"Wayne King" <wmkingty@gmail.com> wrote in message <hj6nv3$re3$1@fred.mathworks.com>...
> "James Pau" <the_mantis81@hotmail.com> wrote in message <hj6n6n$9q8$1@fred.mathworks.com>...
> > Hi there,
> >
> > I've made a Butterworth filter using the 'buttord' and 'butter' functions in MATLAB which gives me a desirable response. However, when I try to recreate the same filter using the fdatool so that I can generate a block for use in Simulink, the response is quite different (i've checked this on the same input signal).
> >
> > Would anyone know the reason why this might be?
> >
> > Thanks in advance,
> > James
> Hi James, can you provide the specifics of how you are specifying the filter at the command line and in fdatool?
>
> Thanks,
> Wayne

Hi Wayne, thanks for your response. Here is how the filter is being defined and applied as a function:

function [sig_filt] = butter_low_pass(sig, Fs);
% sig is the input signal and Fs is the sampling frequency

Fpass = 1; % Passband Frequency
Fstop = 3; % Stopband Frequency
Apass = 1; % Passband Ripple (dB)
Astop = 80; % Stopband Attenuation (dB)
    
% Calculate the order from the parameters using BUTTORD.
[N,Fc] = buttord(Fpass/(Fs/2), Fstop/(Fs/2), Apass, Astop);

% Calculate the zpk values using the BUTTER function.
[z,p] = butter(N, Fc);
sig_filt=filter(z,p,sig);

When using the fdatool, the specifications I use are:
Response type - Lowpass
Design method - IIR butterworth
Filter order - minimum order
Frequency specifications - Fs = 100 Hz (same as in the butter_low_pass function)
                                    Fpass = 1, Fstop = 3
Magnitude specifications - Units = dB, Apass = 1, Astop = 80

As you can see the specifications are the same, and I am aware that the fdatool will use the 'butter' function to design the filter. However, when i export the filter to a simulink model and compare the outputs with the same signal, they're not the same.

Thanks,
James

Subject: fdatool vs buttord and butter functions

From: James Pau

Date: 20 Jan, 2010 22:15:22

Message: 4 of 4

"James Pau" <the_mantis81@hotmail.com> wrote in message <hj7qt6$198$1@fred.mathworks.com>...
> "Wayne King" <wmkingty@gmail.com> wrote in message <hj6nv3$re3$1@fred.mathworks.com>...
> > "James Pau" <the_mantis81@hotmail.com> wrote in message <hj6n6n$9q8$1@fred.mathworks.com>...
> > > Hi there,
> > >
> > > I've made a Butterworth filter using the 'buttord' and 'butter' functions in MATLAB which gives me a desirable response. However, when I try to recreate the same filter using the fdatool so that I can generate a block for use in Simulink, the response is quite different (i've checked this on the same input signal).
> > >
> > > Would anyone know the reason why this might be?
> > >
> > > Thanks in advance,
> > > James
> > Hi James, can you provide the specifics of how you are specifying the filter at the command line and in fdatool?
> >
> > Thanks,
> > Wayne
>
> Hi Wayne, thanks for your response. Here is how the filter is being defined and applied as a function:
>
> function [sig_filt] = butter_low_pass(sig, Fs);
> % sig is the input signal and Fs is the sampling frequency
>
> Fpass = 1; % Passband Frequency
> Fstop = 3; % Stopband Frequency
> Apass = 1; % Passband Ripple (dB)
> Astop = 80; % Stopband Attenuation (dB)
>
> % Calculate the order from the parameters using BUTTORD.
> [N,Fc] = buttord(Fpass/(Fs/2), Fstop/(Fs/2), Apass, Astop);
>
> % Calculate the zpk values using the BUTTER function.
> [z,p] = butter(N, Fc);
> sig_filt=filter(z,p,sig);
>
> When using the fdatool, the specifications I use are:
> Response type - Lowpass
> Design method - IIR butterworth
> Filter order - minimum order
> Frequency specifications - Fs = 100 Hz (same as in the butter_low_pass function)
> Fpass = 1, Fstop = 3
> Magnitude specifications - Units = dB, Apass = 1, Astop = 80
>
> As you can see the specifications are the same, and I am aware that the fdatool will use the 'butter' function to design the filter. However, when i export the filter to a simulink model and compare the outputs with the same signal, they're not the same.
>
> Thanks,
> James

Hi all,

I figured out what my problem was. The outputs do match - it was just a matter of distinguishing the results in real time.

Thanks for the interest anyway.
James

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us