0% found this document useful (0 votes)
8 views2 pages

DSP Exp5

The document contains MATLAB code for computing and plotting the impulse and step responses of a discrete-time system using defined transfer function coefficients. It generates an impulse signal and a unit step input, applies the filter function, and displays the results. The impulse and step responses are visualized using stem plots with appropriate titles and labels.

Uploaded by

pskiran
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)
8 views2 pages

DSP Exp5

The document contains MATLAB code for computing and plotting the impulse and step responses of a discrete-time system using defined transfer function coefficients. It generates an impulse signal and a unit step input, applies the filter function, and displays the results. The impulse and step responses are visualized using stem plots with appropriate titles and labels.

Uploaded by

pskiran
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/ 2

5a.

Impulse response:

clc;

clear all;

close all;

% MATLAB code to compute impulse response using transfer function

% Define system coefficients

b = [1, -0.5]; % Numerator coefficients (example)

a = [1, -1.2, 0.8]; % Denominator coefficients (example)

% Define the number of samples for the impulse response

N = 20; % Number of samples

% Generate an impulse signal

impulse = [1; zeros(N-1, 1)]; % Delta function (length N)

% Compute the impulse response using filter

h = filter(b, a, impulse);

% Display and plot the impulse response

disp('Impulse Response:');

disp(h);

% Plot the impulse response

stem(0:N-1, h, 'filled');

title('Impulse Response of the System');

xlabel('n (Samples)');

ylabel('h[n]');

grid on;

5.b.STEP RESPONSE:

% MATLAB code to compute step response using transfer function

% Define system coefficients

b = [1, -0.5]; % Numerator coefficients (example)

a = [1, -1.2, 0.8]; % Denominator coefficients (example)

% Define the number of samples for the step response

N = 20; % Number of samples


% Generate a unit step input

step_input = ones(N, 1); % Step function (length N)

% Compute the step response using filter

s = filter(b, a, step_input);

% Display and plot the step response

disp('Step Response:');

disp(s);

% Plot the step response

stem(0:N-1, s, 'filled');

title('Step Response of the Discrete-Time System');

xlabel('n (Samples)');

ylabel('s[n]');

grid on;

You might also like