%%even add odd parts of signals
clc;
close all;
clear all;
t=0:0.001:10;
x1=sin(t)+cos(t);
subplot(2,2,1);
plot(t,x1);
grid;
xlabel('time');
ylabel('amplitude');
title('first signal');
x2=sin(-t)+cos(-t);
subplot(2,2,2);
plot(t,x2);
grid;
xlabel('time');
ylabel('amplitude');
title('second signal');
xe=1/2*(x1+x2);
subplot(2,2,3);
plot(t,xe);
grid;
xlabel('time');
ylabel('amplitude');
title('even part of the signal');
xo=1/2*(x1-x2);
subplot(2,2,4);
plot(t,xo);
grid;
xlabel('time');
ylabel('amplitude');
title('odd part of the signal');