1, Cross Correlation: 2, To Perform Discrete-Time Exponential Harmonics
1, Cross Correlation: 2, To Perform Discrete-Time Exponential Harmonics
Exponential Harmonics
clc; clc;
clear all; clear all;
close all; close all;
x=input(' Enter The sequence 1: '); N=3;
h=input(' Enter The sequence 2: '); w=2*pi/N;
y=xcorr(x,h); fs=500; % Real time sample rate
figure; (hz)
subplot(3,1,1); t=-3:1/fs:3; % Time index (s)
stem(x); n= -3:1:3; %sample index
xlabel('n--->'); for cnt = 1:4;
ylabel('Amplitude--->'); subplot(4,2,cnt*2-1);
title('Input Sequence 1');
h=plot(t,real(exp(j*cnt*w*t)),'r');
subplot(3,1,2); set(h,'Linewidth',1);
stem(h); hold on;
xlabel('n--->');
ylabel('Amplitude--->'); h=stem(n,real(exp(j*cnt*w*n)),'.');
title('Input Sequence 2'); hold off;
box off;
subplot(3,1,3); grid on;
stem(fliplr(y)); xlim([min(t) max(t)]);
xlabel('n--->'); ylim([-1.1 1.1]);
ylabel('Amplitude--->'); ylabel(sprintf('\\phi_%d',cnt));
title('Output Sequence'); subplot(4,2,cnt*2);
disp(' The resultant is: ');
fliplr(y) %% Row flip h=plot(t,imag(exp(j*cnt*w*t)),'r');
set(h,'Linewidth',1);
r=corrcoef(y) hold on;
h=stem(n,imag(exp(j*cnt*w*n)),'g');
hold off;
box off;
grid on;
xlim([min(t) max(t)]);
ylim([-1.1 1.1]);
ylabel(sprintf('\\phi_%d',cnt));
end;