Thanks to visit codestin.com
Credit goes to www.scribd.com

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

Ss Passignment 1 Mab

The document outlines an assignment by Siddhi Pawase on generating and plotting various time-domain signals, including impulse, unit step, exponential, unit ramp, sinc, and rectangular signals using MATLAB. It includes MATLAB code for creating these signals and their corresponding amplitude and phase spectra. The assignment emphasizes verifying the results through graphical representation in both time and frequency domains.

Uploaded by

bunnysenpai962
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)
19 views4 pages

Ss Passignment 1 Mab

The document outlines an assignment by Siddhi Pawase on generating and plotting various time-domain signals, including impulse, unit step, exponential, unit ramp, sinc, and rectangular signals using MATLAB. It includes MATLAB code for creating these signals and their corresponding amplitude and phase spectra. The assignment emphasizes verifying the results through graphical representation in both time and frequency domains.

Uploaded by

bunnysenpai962
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

Name :- Siddhi Pawase

Subject :- Signals & systems


Assignment No. 1

Title :- Generate and plot the following signals in time domain and also sketch its
amplitude and phase spectrum. Verify the result: Impulse Unit Step Exponential
Unit ramp Sinc Rectangular.

Matlab Program :-

% MATLAB code to generate and plot time-domain signals and their


spectra
% Time vector for plotting
t = -5:0.01:5; % Time from -5 to 5 seconds with a step size of 0.01
fs = 100; % Sampling frequency
f = linspace(-fs/2, fs/2, length(t)); % Frequency axis
% 1. Impulse Signal (Dirac delta)
impulse_signal = (t == 0); % Impulse function at t = 0
% 2. Unit Step Signal
unit_step_signal = t >= 0; % Unit step function
% 3. Exponential Signal
exponential_signal = exp(-0.5*t); % Exponential decay
% 4. Unit Ramp Signal
unit_ramp_signal = max(0, t); % Ramp signal
% 5. Sinc Signal
sinc_signal = sinc(t); % sinc function
% 6. Rectangular Signal
rectangular_signal = double(abs(mod(t, 1) - 0.5) < 0.5); %
Rectangular pulse of width 1
% Plot time-domain signals
figure;
subplot(3,2,1);
plot(t, impulse_signal, 'LineWidth', 2);
title('Impulse Signal');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
subplot(3,2,2);
plot(t, unit_step_signal, 'LineWidth', 2);
title('Unit Step Signal');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
subplot(3,2,3);
plot(t, exponential_signal, 'LineWidth', 2);
title('Exponential Signal');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
subplot(3,2,4);
plot(t, unit_ramp_signal, 'LineWidth', 2);
title('Unit Ramp Signal');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
subplot(3,2,5);
plot(t, sinc_signal, 'LineWidth', 2);
title('Sinc Signal');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
subplot(3,2,6);
plot(t, rectangular_signal, 'LineWidth', 2);
title('Rectangular Signal');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
% Now, calculate and plot the Frequency Domain (Amplitude and Phase
Spectra)
signals = {impulse_signal, unit_step_signal, exponential_signal,
unit_ramp_signal, sinc_signal, rectangular_signal};
signal_titles = {'Impulse Signal', 'Unit Step Signal', 'Exponential
Signal', 'Unit Ramp Signal', 'Sinc Signal', 'Rectangular Signal'};
% Create a new figure for the frequency domain analysis
figure;
for i = 1:6
signal = signals{i};

% Compute the Fourier Transform of the signal


signal_fft = fftshift(fft(signal)); % FFT and shift zero frequency
component to center
amplitude_spectrum = abs(signal_fft); % Amplitude Spectrum
phase_spectrum = angle(signal_fft); % Phase Spectrum

% Plot the Amplitude Spectrum


subplot(6,2,2*i-1);
plot(f, amplitude_spectrum, 'LineWidth', 2);
title([signal_titles{i}, ' - Amplitude Spectrum']);
xlabel('Frequency (Hz)');
ylabel('Amplitude');
grid on;

% Plot the Phase Spectrum


subplot(6,2,2*i);
plot(f, phase_spectrum, 'LineWidth', 2);
title([signal_titles{i}, ' - Phase Spectrum']);
xlabel('Frequency (Hz)');
ylabel('Phase (radians)');
grid on;
end

OUTPUT :-

FIGURE 1 :-
FIGURE 2:-

You might also like