
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















Waveform Generation ➢ Unit impulse signal ➢ Unit step signal ➢ Unit ramp signal ➢ Exponential signal
Continuous V.S. Discrete Plotting Acc = 50 ; % Accuracy = 50 sample t = linspace(0,360, Acc); fm = 1 ; % frequency = 1 hertz y = sind(tfm); %sine degree stem(t,y); %plotting axis([ 0 t(end) 1.5min(y) 1.5*max(y)]); grid; %put a grid behind the plot title("Sine Wave Plot ( Discrete )"); xlabel("Time (Second)"); ylabel("Velocity (meter/Second)");
Unit Impulse Signal % UNIT IMPULSE SIGNAL t = linspace(-3,3,1001); %time vector %impulse vector p = [zeros(1,500) 1 zeros(1,500)]; plot(t,p,'linewidth',2.5); axis([t( 1 ) t(end) 1.5min(p) 1.5max(p)]); xlabel('time'); ylabel('Amplitude'); title('Unit impulse signal');
Unit Impulse Signal % UNIT IMPULSE SIGNAL t = linspace(-3,3,1001); %time vector %impulse vector for i = 1 : length(t) if t(i) == 0 p(i) = 1 ; else p(i) = 0 ; end end plot(t,p,'linewidth',2.5); axis([t( 1 ) t(end) 1.5min(p) 1.5max(p)]); xlabel('time'); ylabel('Amplitude'); title('Unit impulse signal');
Unit Impulse Signal % UNIT IMPULSE SIGNAL t = - 3:1:3; %time vector p = [0,0,0,1,0,0,0]; %impulse vector stem(t,p,'linewidth',1.5); axis([t( 1 ) t(end) 1.5min(p) 1.5max(p)]); xlabel('time'); ylabel('Amplitude'); title('Unit impulse signal');
Unit Step Signal %UNIT STEP SIGNAL clc; clear; close all; t = linspace(-10,10,1000); u = heaviside(t); plot(t,u,'linewidth', 3 ); xlabel('time'); ylabel('Amplitude'); title('Unit step signal (Continuous)'); xlim([t( 1 ) t(end)]); ylim([1.5min(u) 1.5max(u)]);
Unit Step Signal %UNIT STEP SIGNAL clc; clear; close all; t = - 10:10; u = [zeros(1,10) ones(1,11)]; stem(t,u,'linewidth',1.5); xlabel('time'); ylabel('Amplitude'); title('Unit step signal (Continuous)'); xlim([t( 1 ) t(end)]); ylim([1.5min(u) 1.5max(u)]); grid on;
Unit Ramp Signal %UNIT RAMP SIGNAL clc; clear; close all; t = linspace(-10,20,31); r = t; stem(t,r,'linewidth',1.7); xlabel('time'); ylabel('Amplitude'); title('Unit ramp signal'); xlim([t( 1 ) t(end)]); ylim([min(r) max(r)]); grid;
Exponential Signal %EXPONENTIAL SIGNAL a = 0.1; t = - 10:1:20; x 1 = exp(- 1 at); x 2 = exp( 1 at); subplot(2,1,1); stem(t,x 1 ); xlabel('time'); ylabel('Amplitude'); title('Exponential decaying signal'); %%%% subplot(2,1,2); stem(t,x 2 ); xlabel('time'); ylabel('Amplitude'); title('Exponential growing signal');
Signal Addition
t = - 10:20; y 1 = [zeros(1,10) 1 1 1 zeros(1,18)]; subplot(3,1,1); stem(t,y 1 ,'linewidth',1.5); title('Y 1 '); axis([t( 1 ) t(end) min(y 1 ) max(y 1 )]); grid; %%%% y 2 = [zeros(1,10) ones(1,21)]; subplot(3,1,2); stem(t,y 2 ,'linewidth',1.5) title('Y 2 '); axis([t( 1 ) t(end) min(y 2 ) max(y 2 )]); grid; %%%% y = y 1 +y 2 ; subplot(3,1,3); stem(t,y,'linewidth',1.5); title('Y = Y 1 +Y 2 '); axis([t( 1 ) t(end) min(y) max(y)]); grid;
Signal Subtraction With help of the previous slide perform a subtraction operation to the signals y 1 and y 2 by yourself and show me the resulting waveform and put a new graph in the same subplot to have 4 subplots inside the previous figure?
Amplitude Scaling (Attenuating) With help of the previous slide perform a Scaling operation to the signals y 1 via attenuating the signal by multiply it with 0. 3 scalar and show me the resulting waveform in independent figure?
Time Scaling (Expanding) %SIGNAL TIME EXPANDING t = - 10:10; h 1 = [ones(1,7) - 5 1 0 4 - 2 3 3 1 zeros(1,6)]; subplot(2,1,1); stem(t,h 1 ,'linewidth',1.5); title('H 1 (t) (before Time Expansion)'); axis([t( 1 ) t(end) 1.5min(h 1 ) 1.5max(h 1 )]); grid on; grid minor; %%%% t 2 = 3 t; subplot(2,1,2); stem(t 2 ,h 1 ,'linewidth',1.5) title('H 1 (t) (after Time Expansion)'); axis([t( 1 ) t(end) 1.5min(h 1 ) 1.5*max(h 1 )]); grid on; grid minor; Y(t) = Y(at) ( Where a> 1 )