SOURCE Code
SOURCE Code
% Define parameters
n = 30:40;
n_0 = 34; % ID - 2002034
x = zeros (1 , length ( n ) ) ;
% Customize appearance
set ( gca , ’ Box ’ , ’ on ’ , ’ LineWidth ’ , 1.2 , ’ FontSize ’ , 10 , ’ FontWeight ’ , ’ bold ’) ;
set ( gcf , ’ Color ’ , ’w ’) ;
1
Shifted Unit Step Function
clc ;
clear all ; % # ok < CLALL >
close all ;
% Define parameters
n = 30:40;
n_0 = 34; % ID - 2002034
x = zeros (1 , length ( n ) ) ;
% Customize appearance
set ( gca , ’ Box ’ , ’ on ’ , ’ LineWidth ’ , 1.2 , ’ FontSize ’ , 10 , ’ FontWeight ’ , ’ bold ’) ;
set ( gcf , ’ Color ’ , ’w ’) ;
2
Shifted Ramp Function
clc ;
clear all ; % # ok < CLALL >
close all ;
% Define parameters
n = 30:40;
n_0 = 34; % ID - 2002034
x = zeros (1 , length ( n ) ) ;
% Customize appearance
set ( gca , ’ Box ’ , ’ on ’ , ’ LineWidth ’ , 1.2 , ’ FontSize ’ , 10 , ’ FontWeight ’ , ’ bold ’) ;
set ( gcf , ’ Color ’ , ’w ’) ;
3
Random Signal
clc ; clear ; close all ;
n = -20:20;
% Delta Functions
delta = (( n ==0) ) ;
shifted_delta = (( n ==5) ) ;
% Ramp Functions
ramp = n .* step ;
scaled_ramp = 0.7* ramp ;
% Random Signal
random = 0.1* shifted_step + 0.2* scaled_ramp + 0.2* added_signal + 0.5* subtract_signal + 0.9*
diff_add + intgr_subtr ;
subplot (3 , 2 , 1) ;
stem (n , shifted_step , ’ filled ’ , ’ MarkerFaceColor ’ , ’b ’ , ’ MarkerSize ’ , 6) ;
xlabel ( ’n ’) ; ylabel ( ’ Amplitude ’) ; title ( ’ Shifted ␣ Step ␣ Function ’) ;
grid on ;
subplot (3 , 2 , 2) ;
stem (n , scaled_ramp , ’ filled ’ , ’ MarkerFaceColor ’ , ’r ’ , ’ MarkerSize ’ , 6) ;
xlabel ( ’n ’) ; ylabel ( ’ Amplitude ’) ; title ( ’ Scaled ␣ Ramp ␣ Function ’) ;
grid on ;
subplot (3 , 2 , 3) ;
stem (n , added_signal , ’ filled ’ , ’ MarkerFaceColor ’ , ’g ’ , ’ MarkerSize ’ , 6) ;
xlabel ( ’n ’) ; ylabel ( ’ Amplitude ’) ; title ( ’ Added ␣ Signal ’) ;
grid on ;
subplot (3 , 2 , 4) ;
stem (n , subtract_signal , ’ filled ’ , ’ MarkerFaceColor ’ , ’m ’ , ’ MarkerSize ’ , 6) ;
xlabel ( ’n ’) ; ylabel ( ’ Amplitude ’) ; title ( ’ Subtracted ␣ Signal ’) ;
grid on ;
subplot (3 , 2 , 5) ;
stem (n , diff_add , ’ filled ’ , ’ MarkerFaceColor ’ , ’c ’ , ’ MarkerSize ’ , 6) ;
xlabel ( ’n ’) ; ylabel ( ’ Amplitude ’) ; title ( ’ Differentiated ␣ Signal ’) ;
grid on ;
subplot (3 , 2 , 6) ;
stem (n , intgr_subtr , ’ filled ’ , ’ MarkerFaceColor ’ , ’y ’ , ’ MarkerSize ’ , 6) ;
xlabel ( ’n ’) ; ylabel ( ’ Amplitude ’) ; title ( ’ Integrated ␣ Signal ’) ;
4
grid on ;