Even and Odd Decomposition of a Signal in MATLAB
The code can be written by simply modifying the code to add two discrete signals which I have already discussed in my previous video.
Check this video to understand, how to add 2 discrete signals in MATLAB:
Signal addition in MATALB
Step 1:
Here, you don't need 2 inputs, take only one input signal.
Step2:
Take the second signal as a flipped version of the input signal(i.e. if you define x as my first input signal then the second signal is y=fliplr(x))
Step3:
If my first signal has a time sample range as n1 then for the second signal, the range will be n2=-fliplr(n1);
(this is the concept of flipping a signal in MatLab or Time Reversal, this also I have covered in my previous video)
Check the video to understand, how to do time reversal in MATLAB:
Time reversal of a sequence (DSP)
Step4:
Now write the same code as discussed in Addition of 2 signals in MATLAB
Step5:
Now instead of adding dirrectly , to calculate the even part use the formula--z3=(z1+z2)/2
& to calculate the odd part use the formula--z=(z1-z2)/2
Step6:
Plot that waveforms
In this video I have shown , even and odd decomposition of u(n)-u(n-10) signal
MATLAB Program: Even and Odd Decomposition of a Signal in MATLAB
No comments