0% found this document useful (0 votes)
2 views4 pages

MTLB9

The document outlines an experiment to design a high-pass Butterworth filter using specified transfer function coefficients and analyze its performance through MATLAB. It details the theoretical background, implementation steps, and results, demonstrating the filter's effectiveness in attenuating low-frequency components while preserving high-frequency signals. The experiment emphasizes the practical applications of high-pass filters in signal processing for noise reduction and signal separation.

Uploaded by

aditya arya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

MTLB9

The document outlines an experiment to design a high-pass Butterworth filter using specified transfer function coefficients and analyze its performance through MATLAB. It details the theoretical background, implementation steps, and results, demonstrating the filter's effectiveness in attenuating low-frequency components while preserving high-frequency signals. The experiment emphasizes the practical applications of high-pass filters in signal processing for noise reduction and signal separation.

Uploaded by

aditya arya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

EXPERIMENT-9

OBJECTIVE: To design a high pass filter from given transfer


func on coefficients and plot input ( me and frequency domain),
output ( me and frequency domain) and frequency response of
filter.
THEORY:
Filters are used to filter out unwanted frequencies from a given input
signal. A Bu erworth filter is a type of analog or digital filter known for
its maximally flat frequency response in the passband. It is characterized
by a smooth transi on between the passband and stopband.
The bu er func on is used to design a Bu erworth filter with a specified
cutoff frequency (fc). The filter order is set to 2, and Fc/(Fs/2) is the
normalized cutoff frequency, where Fs is the sampling frequency.
The transfer func on of the high-pass Bu erworth filter is calculated
using the coefficients obtained from the bu er func on. This transfer
func on, represented as H(z), describes the filter's behaviour in the
frequency domain. The transfer func on for a high-pass filter can be
represented as H(s), where s is the complex frequency variable. It can be
expressed in terms of coefficients, typically involving resistors and
capacitors, which determine its cutoff frequency and characteris cs. The
impulse response of the filter (h_n) is calculated using the impulse
func on. The impulse response represents the filter's me-domain
behaviour and describes how it responds to an impulse input.
To implement a high pass filter, we first determine the transfer func on
from given coefficients and find its inverse z transform by compu ng its
impulse response h[n]. A er finding its impulse response , the output
y[n] can be wri en as : y[n]=h[n]*x[n].

122EC0339
MATLAB CODE:
clc;close all;clear all;

fc=400;
Fs=1000;
%using butterworth filter to find the tf coefficients for a given fc
[b,a]= butter(2,(fc/(Fs/2)),"high")
H_z=tf(b,a,1);%transfer function

n=0:20; % Length of impulse response (adjust as needed)


h_n = impulse(H_z, n);

%Define the time vector


t = 0: (1/Fs) :1; %Time from 0 to 1 second with a 1 ms time step

% Create a signal composed of distinct sinusoids


freq =[10, 450]; %Frequencies in Hz
x = sin(2*pi* freq(1)*t) + sin(2*pi*freq(2)*t) ; %input signal

% Convolve the input signal with h(n) to get the output signal
y= conv (x, h_n, 'same');

% Calculate the frequency domain representation of the input, filter, and output
Xf=fft(x);
Hf=fft(h_n, length (Xf));
Yf=fft(y);

% Define the frequency axis


frequencies = (0:length(Xf) - 1) * (Fs / length(Xf));

%Plot the input signal


figure;
subplot (3, 1, 1);
plot (t, x);
title('Input Signal (Distinct Sinusoids) ');
xlabel('Time (s)');
ylabel('Amplitude');

% Plot the output signal (filtered low-pass)


subplot (3, 1, 2);
plot (t, y);
title('Output Signal (Filtered High pass)');
xlabel('Time (s)');
ylabel('Amplitude');

%Plot the magnitude of the frequency response H(f)


subplot (3, 1, 3);
plot (frequencies, abs(Hf));
title('Magnitude of H (f)');
xlabel('Frequency (Hz)');
ylabel('|H(f)|');
xlim ([0 500])

title('Input, Filtered Output, and Magnitude of H(f)');

%Plot the frequency domain representations


figure;
subplot (2, 1, 1);
plot ( frequencies,(abs(Xf)));
title('Input Signal Frequency Domain Representation');
xlabel('Frequency (Hz)')
ylabel('|X(f) |');
xlim ([0 500])

122EC0339
subplot (2, 1, 2);
plot (frequencies, abs(Yf));
title('Output Signal Frequency Domain Representation (Y(f))');
xlabel('Frequency (Hz)');
ylabel('|Y(f)|');
xlim([0 500])

MATLAB RESULTS:

122EC0339
DISCUSSION ON RESULTS:
The output signal clearly showcased the filtering ac on of the high-pass
filter. The lower-frequency component (10 Hz) was significantly
a enuated, while the higher-frequency component (450 Hz) was
preserved. This demonstrates that the filter effec vely passes signals
above the cutoff frequency while suppressing lower-frequency content,
in line with high-pass filter expecta ons. The magnitude of the filter's
frequency response was plo ed, providing a visual representa on of its
behaviour across the frequency spectrum. The plot confirmed that the
filter's magnitude response increases with frequency, which aligns with
the characteris cs of a high-pass filter. The impulse response of the filter
revealed its response to an impulse input. It allowed us to observe how
the filter behaves in the me domain, emphasizing the filter's transient
response and its effect on the input signal over me.
CONCLUSION:
In this experiment, we successfully designed a high-pass filter using
specified transfer func on coefficients and leveraged MATLAB to analyze
its performance. The results demonstrated that the filter effec vely
a enuates low-frequency components while preserving high-frequency
signals, as evident in the me and frequency domain representa ons.
The magnitude of the filter's frequency response validated its high-pass
characteris cs. This experiment illustrates the prac cal applica on of
high-pass filters in signal processing, where they are essen al for noise
reduc on, signal separa on, and various other applica ons requiring the
isola on of higher-frequency content.

NAME-AKSHAR DASH
ROLL.NO-122EC0339

122EC0339

You might also like