Not getting single frequency signal...
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have two signals ....1)Signal1=cos(2*pi*fc*t)
2) Signal2=cos(2*pi*(fc+f_delta)*t)
My task is to get the third signal....Signal3=cos(2*pi*f_delta*t). fc=500, f_delta=100,Fs=6000.
i followed this process........x1=acos(Signal1)....acos------>gives inverse of the Signal1.......2*pi*fc*t
x2=acos(Signal2)........which gives 2*pi*(fc+f_delta)*t
y=exp(j*x2).*exp(-1*j*x1);
y=exp(j*(x2-x1))
y=exp(j*2*pi*f_delta*t)
My output...Signal3=real(y)=cos(2*pi*f_delta*t);
But After Obseving the Output in Frequency domain i am not getting the single Frequency spectrum which is f_delta...i am getting multiple frequencies ....
1..what is the reason behind the multiple frequencies ?
2..Is there any wrong in the process i followed ?
3..If possible suggest me another process to get the output Signal3...?
Thanks in advance....
1 Commento
Daniel M
il 24 Nov 2019
Please format your question in a readable fashion if you want someone to read it.
Risposte (1)
Dimitris Kalogiros
il 24 Nov 2019
Modificato: Dimitris Kalogiros
il 24 Nov 2019
Hi Hari
You can use the following algorithm:
clc; clearvars; close all;
%% definition of frequencies
fc=500;
f_delta=100;
Fs=6000;
%% sampling time instances
t=0:1/Fs:10;
%% initial signals
Signal1=cos(2*pi*fc.*t);
Signal2=cos(2*pi*(fc+f_delta).*t);
%% product of signals
%Usage of the trigonometric identity:
%cos(A)*cos(B)=(1/2)*( cos(A+B) + cos(A-B) )
Sp=2*Signal1.*Signal2;
%% filter out high frequencies
% definition of low pass filter
Fpass = 200; % Passband Frequency
Fstop = 900; % Stopband Frequency
Dpass = 0.0057563991496; % Passband Ripple
Dstop = 0.0001; % Stopband Attenuation
dens = 20; % Density Factor
[N, Fo, Ao, W] = firpmord([Fpass, Fstop]/(Fs/2), [1 0], [Dpass, Dstop]);
b = firpm(N, Fo, Ao, W, {dens});
Hd = dfilt.dffir(b);
Hlp=Hd.Numerator;
% filter high frequencies
Signal3=filter(Hlp,1,Sp);
%% graphical representation
% time domain
figure;
timeInterval=(1/Fs)*(1:200);
subplot(2,1,1); plot(timeInterval,Signal1(1:length(timeInterval)),'-b'); hold on;
subplot(2,1,1); plot(timeInterval,Signal2(1:length(timeInterval)),'-r'); hold on;
subplot(2,1,1); plot(timeInterval,Signal3(1:length(timeInterval)),'-g', 'color', [0 .5 0], 'linewidth',2); zoom on; grid on;
legend('Signal1', 'Signal2','Signal3' ); xlabel('sec'), ylabel('amplitude'); title('time domain');
% frequency domain
fftsize=2^12;
freq=(Fs/fftsize)*(0:(fftsize/2)-1);
SP1=mag2db(abs(fft(Signal1,fftsize)));
SP2=mag2db(abs(fft(Signal2,fftsize)));
SP3=mag2db(abs(fft(Signal3,fftsize)));
subplot(2,1,2); plot(freq,SP1(1:length(freq)),'-b'); hold on;
subplot(2,1,2); plot(freq,SP2(1:length(freq)),'-r'); hold on;
subplot(2,1,2); plot(freq,SP3(1:length(freq)),'-g','color', [0 .5 0],'linewidth',1 ); grid on; zoom on;
legend('Signal1', 'Signal2','Signal3' ); xlabel('frequency'), ylabel('dB'); title('frequency domain');
ylim([-20, 100]);
Don't be afraid of its size ... In fact it is quite simple.
The key idea is the following trigonemetric formula: cos(A)*cos(B)=(1/2)*[ cos(A+B) + cos(A-B) ]
If you run the code, you will get the following figure
Do not bother from the fact that spectrums are not perfect dirac functions. To achieve such a thing, you have to use infinite length FFT.
At the beginning, the resulting signal (the green one, on the time domain figure), seems to be "noisy". It is due to the filtering process and it can be ignored.
2 Commenti
Vedere anche
Categorie
Scopri di più su Spectral Measurements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!