MATLAB Answers

Not getting single frequency signal...

3 views (last 30 days)
Hari Ijjada
Hari Ijjada on 23 Nov 2019
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
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 Comment

Daniel M
Daniel M on 24 Nov 2019
Please format your question in a readable fashion if you want someone to read it.

Sign in to comment.

Answers (1)

Dimitris Kalogiros
Dimitris Kalogiros on 24 Nov 2019
Edited: Dimitris Kalogiros on 24 Nov 2019
Hi Hari
You can use the following algorithm:
clc; clearvars; close all;
%% definition of frequencies
%% sampling time instances
%% initial signals
%% product of signals
%Usage of the trigonometric identity:
%cos(A)*cos(B)=(1/2)*( cos(A+B) + cos(A-B) )
%% 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);
% filter high frequencies
%% graphical representation
% time domain
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
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.


Hari Ijjada
Hari Ijjada on 25 Nov 2019
Thanks for your response.
Actually the problem arrises if f_delta changes becuase the above filter works for f_delta 100 Hz only,My intention is to track the f_delta signal irrespective of the f_delta value.
For example if i choose f_delta 200Hz...i need to change the the algorithim again.
can you help me in getting a signal without any filter so that it will work for all the values of can see the method i followed (see it in the question)
Dimitris Kalogiros
Dimitris Kalogiros on 25 Nov 2019
What is the range of f_delta and fc ?

Sign in to comment.

Sign in to answer this question.