Frequency shift of sine wave

99 views (last 30 days)
Dominik Dabski
Dominik Dabski on 13 Feb 2016
Answered: Sk Group on 27 Oct 2021
Hello How to shift frequency of already generated signal? Lets say I have sine signal of 100Hz saved to matrix M, how to change it frequency to 150Hz after it is already generated?

Answers (2)

Star Strider
Star Strider on 13 Feb 2016
You can, but it’s not trivial. It’s described mathematically Angle sum and difference identities and Product-to-sum and sum-to-product identities. You have to heterodyne it by mutltiplying it by the appropriate carrier frequency (creating a double-sideband, suppressed-carrier signal), then filter the unwanted sub-harmonic (at 50 Hz here), with a bandpass filter. My filter design procedure is here: How to design a lowpass filter for ocean wave data in Matlab? Note that this will work for frequency-shifting pure frequencies as well as modulated frequencies. (It’s the principle behind amplitude modulated wireless transmission and reception, where a baseband signal is heterodyned to frequency suitable for transmission, and at the other end, to do essentially the opposite in a superheterodyne receiver.)
The code:
t = linspace(0, 1, 1000);
S = sin(2*pi*100*t); % Original Signal
Sc = sin(2*pi*50*t); % ‘Carrier’ Signal
HS = S.*Sc; % Heterodyne Signal
Fs = 1000;
Fn = Fs/2;
FT1 = fft(S)/length(S);
FT2 = fft(HS)/length(HS);
Fv = linspace(0, 1, fix(length(FT1)/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
figure(1)
subplot(2,1,1)
plot(Fv, 2*abs(FT1(Iv)))
grid
subplot(2,1,2)
plot(Fv, 2*abs(FT2(Iv)))
grid
  1 Comment
bzibubab bzibubab
bzibubab bzibubab on 28 Jan 2020
in this case, we already knew the function of a signal so that the operation of the Hs calculation is possible by simply changing the carrier frequency of the carrier function. If the frequency of the signal you want to change comes from wav / audio, where the frequency of the carrier can be changed if the function of the carrier signal can be known, then what should we do?

Sign in to comment.


Sk Group
Sk Group on 27 Oct 2021

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!