Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
17 views

Discrete Diff Int PDF

The document defines impulse and step signals with and without delays. It then computes the difference between the original and delayed signals. It applies discrete differentiation and integration to the difference signals and plots the original, derivative, and integral signals. The purpose is to examine how discrete differentiation and integration operators work on signals with delays.

Uploaded by

Song Hang Chai
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Discrete Diff Int PDF

The document defines impulse and step signals with and without delays. It then computes the difference between the original and delayed signals. It applies discrete differentiation and integration to the difference signals and plots the original, derivative, and integral signals. The purpose is to examine how discrete differentiation and integration operators work on signals with delays.

Uploaded by

Song Hang Chai
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

25/2/23 3:04 PM test.

m 1 of 2

% Define the range of values for n


n = -10:20;

% Define the impulse signal


impulse_n = [zeros(1,10) 1 zeros(1,10)];

% Define the impulse signal with delay of 5


impulse_n5 = [zeros(1,15) 1 zeros(1,5)];

% Compute the difference signal


diff_impulse_n = impulse_n - impulse_n5;

% Define the step signal using u(n)


u = (n >= 0);
step_n = u;

% Define the step signal with delay of 11 using u(n-11)


u11 = (n-11 >= 0);
step_n11 = u11;

% Compute the difference signal


diff_step_n = step_n - step_n11;

% Apply discrete differentiator and integrator


Ts = 0.01; % Sampling time interval
diff_diff_impulse_n = discrete_differentiator(diff_impulse_n, Ts);
diff_diff_step_n = discrete_differentiator(diff_step_n, Ts);
int_diff_impulse_n = discrete_integrator(diff_impulse_n, Ts);
int_diff_step_n = discrete_integrator(diff_step_n, Ts);

% Plot the signals and their derivatives/integrals


% The y variables of stem(x,y) in these cases are one element less than x
% variable, thus I adjust the length of n accordingly
figure(1);
subplot(3,1,1);
stem(n(1:length(diff_impulse_n)), diff_impulse_n);
title('Impulse Function[n] - Impulse Function[n-5]', 'FontSize', 16);
xlabel('n', 'FontSize', 14);
ylabel('Amplitude', 'FontSize', 14);

% Derivatives of impulse function


subplot(3,1,2);
stem(n(1:length(diff_diff_impulse_n)), diff_diff_impulse_n);
title('Derivative of Impulse Function[n] - Impulse Function[n-5]', 'FontSize', 16);
xlabel('n', 'FontSize', 14);
ylabel('Amplitude', 'FontSize', 14);

% Integrals of impulse function


subplot(3,1,3);
stem(n(1:length(int_diff_impulse_n)), int_diff_impulse_n);
title('Integral of Impulse Function[n] - Impulse Function[n-5]', 'FontSize', 16);
xlabel('n', 'FontSize', 14);
ylabel('Amplitude', 'FontSize', 14);

% Plot the signals and their derivatives/integrals


% The y variables of stem(x,y) in these cases are one element less than x
% variable, thus I adjust the length of n accordingly
figure(2);
subplot(3,1,1);
stem(n(1:length(diff_step_n)), diff_step_n);
title('Step Function[n] - Step Function[n-11]', 'FontSize', 16);
xlabel('n', 'FontSize', 14);
25/2/23 3:04 PM test.m 2 of 2

ylabel('Amplitude', 'FontSize', 14);

% Derivatives of step function


subplot(3,1,2);
stem(n(1:length(diff_diff_step_n)), diff_diff_step_n);
title('Derivative of Step Function[n] - Step Function[n-11]', 'FontSize', 16);
xlabel('n', 'FontSize', 14);
ylabel('Amplitude', 'FontSize', 14);

% Integrals of step function


subplot(3,1,3);
stem(n(1:length(int_diff_step_n)), int_diff_step_n);
title('Integral of Step Function[n] - Step Function[n-11]', 'FontSize', 16);
xlabel('n', 'FontSize', 14);
ylabel('Amplitude', 'FontSize', 14);

You might also like