Signal operations - PART 1
Signal operations - PART 1
Addition (DT)
x=[1 2 3 4];
subplot(3,1,1);
stem(x);
title('X');
y=[1 1 1 1];
subplot(3,1,2);
stem(y);
title('Y');
z=x+y;
subplot(3,1,3);
stem(z);
title('Z=X+Y');
Multiplication of Signals
% Define two signals
t = 0:0.01:1; % Time vector
signal1 = sin(2*pi*5*t); % First signal: Sine wave
signal2 = cos(2*pi*5*t); % Second signal: Cosine wave
t=0:10;
x=[0 1 2 1 0 1 2 0 1 2 1 ];
subplot(3,1,1)
plot(t,x)
title('Simple Signal')
xlabel('Time')
ylabel('Amplitude')
grid on;
axis([-2 8 0 4]);
subplot(3,1,2)
plot(t+2,x)
title('Shifting by addition')
xlabel('Time')
ylabel('Amplitude')
grid on;
axis([-2 8 0 4]);
subplot(3,1,3)
plot(t-2,x)
title('Shifting by Subtraction')
xlabel('Time')
ylabel('Amplitude')
grid on;
axis([-2 8 0 4]);