Exp 6
Exp 6
Adding Signals
Explanation: Adding two signals combines their amplitudes at each point in
time.
Steps:
1. Add the sine and cosine wave signals.
2. Plot the resulting signal.
MATLAB Code:
1
z = x + y;
plot (t , z ) ;
xlabel ( ’ Time ’) ;
ylabel ( ’ Amplitude ’) ;
title ( ’ Addition of Sine and Cosine Waves ’) ;
grid on ;
Subtracting Signals
Explanation: Subtracting one signal from another takes the difference of their
amplitudes at each point in time.
Steps:
Scaling a Signal
Explanation: Multiplying a signal by a scalar changes its amplitude.
Steps:
1. Multiply the sine wave by a scalar.
2. Plot the resulting scaled signal.
MATLAB Code:
scaled_x = 2 * x ;
plot (t , scaled_x ) ;
xlabel ( ’ Time ’) ;
ylabel ( ’ Amplitude ’) ;
title ( ’ Scaled Sine Wave ’) ;
grid on ;
2
Element-wise Multiplication of Signals
Explanation: Element-wise multiplication multiplies corresponding elements
of two signals.
Steps:
1. Multiply the sine and cosine waves element-wise.
Numerical Differentiation
Explanation: Differentiation approximates the derivative of a signal.
Steps:
1. Differentiate the sine wave numerically.
2. Plot the resulting differentiated signal.
MATLAB Code:
dx = diff ( x ) / ( t (2) - t (1) ) ;
plot ( t (1: end -1) , dx ) ;
xlabel ( ’ Time ’) ;
ylabel ( ’ Amplitude ’) ;
title ( ’ Numerical Differentiation of Sine Wave ’) ;
grid on ;
Numerical Integration
Explanation: Integration approximates the cumulative sum of a signal.
Steps:
1. Integrate the sine wave numerically.
3
MATLAB Code:
integral_signal = cumsum ( x ) * ( t (2) - t (1) ) ;
plot (t , integral_signal ) ;
xlabel ( ’ Time ’) ;
ylabel ( ’ Amplitude ’) ;
title ( ’ Numerical Integration of Sine Wave ’) ;
grid on ;
4
xlabel ( ’ Time ’) ;
ylabel ( ’ Amplitude ’) ;
title ( ’ Time Shifted Sine Wave ’) ;
grid on ;
5
Amplitude Scaling a Signal
Explanation: Amplitude scaling changes the amplitude of a signal.
Steps:
1. Scale the amplitude of the sine wave.
2. Plot the resulting scaled signal.
MATLAB Code:
amplitude_scale = 2;
s c a l e d _ a m p l i t u d e _ s i g n a l = x * amplitude_scale ;
plot (t , s c a l e d _ a m p l i t u d e _ s i g n a l ) ;
xlabel ( ’ Time ’) ;
ylabel ( ’ Amplitude ’) ;
title ( ’ Amplitude Scaled Sine Wave ’) ;
grid on ;