Skip to main content
minor edits
Source Link
Gilles
  • 3.4k
  • 3
  • 24
  • 29

I'm attempting to use a frequency mixer to shift one frequency range to another. Right now, I have a complex sine wave at 43KHz$43\ \rm kHz$. My imaginary value on the complex object is 0.

If I output a frequency-amplitude spectrum it looks like this:

enter image description here

Now let's say I want to move that frequency to 65KHz$65\ \rm kHz$. For that I realized that I need to create a new complex sine wave at that frequency and multiply it by my original signal in time.

The problem is, it's not working. I'm getting 2 spikes for some reason. I don't understand why that happens.

enter image description here

Here is my code:

typedef std::complex<float> Complex; Complex chunk[N]; float Fs = 176400; // How many time points are needed i,e., Sampling Frequency const double T = 1 / Fs; // At what intervals time points are sampled float value; float value2; for (int i = 0; i < N; i++) { value2 = (float)(1 * sin(2 * M_PI * 43000 * (i * T))); // Original Signal Complex value3 = {(float)(1 * sin(2 * M_PI * 12000 * (i * T))), 0}; // The frequency I want to add double multiplier = 0.5 * (1 - cos(2*M_PI*i/256)); // Hamming Window chunk[i] = {value2 * multiplier, 0 };// generate (complex) sine waveform chunk[i] = chunk[i] * value3; // Frequency Mixer } 

I'm attempting to use a frequency mixer to shift one frequency range to another. Right now, I have a complex sine wave at 43KHz. My imaginary value on the complex object is 0.

If I output a frequency-amplitude spectrum it looks like this:

enter image description here

Now let's say I want to move that frequency to 65KHz. For that I realized that I need to create a new complex sine wave at that frequency and multiply it by my original signal in time.

The problem is, it's not working. I'm getting 2 spikes for some reason. I don't understand why that happens.

enter image description here

Here is my code:

typedef std::complex<float> Complex; Complex chunk[N]; float Fs = 176400; // How many time points are needed i,e., Sampling Frequency const double T = 1 / Fs; // At what intervals time points are sampled float value; float value2; for (int i = 0; i < N; i++) { value2 = (float)(1 * sin(2 * M_PI * 43000 * (i * T))); // Original Signal Complex value3 = {(float)(1 * sin(2 * M_PI * 12000 * (i * T))), 0}; // The frequency I want to add double multiplier = 0.5 * (1 - cos(2*M_PI*i/256)); // Hamming Window chunk[i] = {value2 * multiplier, 0 };// generate (complex) sine waveform chunk[i] = chunk[i] * value3; // Frequency Mixer } 

I'm attempting to use a frequency mixer to shift one frequency range to another. Right now, I have a complex sine wave at $43\ \rm kHz$. My imaginary value on the complex object is 0.

If I output a frequency-amplitude spectrum it looks like this:

enter image description here

Now let's say I want to move that frequency to $65\ \rm kHz$. For that I realized that I need to create a new complex sine wave at that frequency and multiply it by my original signal in time.

The problem is, it's not working. I'm getting 2 spikes for some reason. I don't understand why that happens.

enter image description here

Here is my code:

typedef std::complex<float> Complex; Complex chunk[N]; float Fs = 176400; // How many time points are needed i,e., Sampling Frequency const double T = 1 / Fs; // At what intervals time points are sampled float value; float value2; for (int i = 0; i < N; i++) { value2 = (float)(1 * sin(2 * M_PI * 43000 * (i * T))); // Original Signal Complex value3 = {(float)(1 * sin(2 * M_PI * 12000 * (i * T))), 0}; // The frequency I want to add double multiplier = 0.5 * (1 - cos(2*M_PI*i/256)); // Hamming Window chunk[i] = {value2 * multiplier, 0 };// generate (complex) sine waveform chunk[i] = chunk[i] * value3; // Frequency Mixer } 
deleted 9 characters in body; edited title
Source Link
JRE
  • 2.3k
  • 1
  • 13
  • 20

Frequency Mixermixer shows 2 FFT spikes

I'm attempting to use a Frequency Mixerfrequency mixer to shift one frequency range to another, right. Right now, I have a complex sine wave at 43KHz,. My imaginary value on the complex object is 0.

If I output a Frequencyfrequency-Amplitudeamplitude spectrum it looks like this:

enter image description here

Now let's say I want to move that frequency to 65KHz, for. For that I realized that I need to create a new complex sine wave at that frequency and multiply it by my original signal in time.

The problem is, it's not working,. I'm getting 2 spikes for some reason I can't. I don't understand as you can see in the imagewhy that happens.

enter image description here

Here is my code:

typedef std::complex<float> Complex; Complex chunk[N]; float Fs = 176400; // How many time points are needed i,e., Sampling Frequency const double T = 1 / Fs; // At what intervals time points are sampled float value; float value2; for (int i = 0; i < N; i++) { value2 = (float)(1 * sin(2 * M_PI * 43000 * (i * T))); // Original Signal Complex value3 = {(float)(1 * sin(2 * M_PI * 12000 * (i * T))), 0}; // The frequency I want to add double multiplier = 0.5 * (1 - cos(2*M_PI*i/256)); // Hamming Window chunk[i] = {value2 * multiplier, 0 };// generate (complex) sine waveform chunk[i] = chunk[i] * value3; // Frequency Mixer } 

Frequency Mixer shows 2 FFT spikes

I'm attempting to use a Frequency Mixer to shift one frequency range to another, right now, I have a complex sine wave at 43KHz, My imaginary value on the complex object is 0.

If I output a Frequency-Amplitude spectrum it looks like this:

enter image description here

Now let's say I want to move that frequency to 65KHz, for that I realized that I need to create a new complex sine wave at that frequency and multiply it by my original signal in time.

The problem is, it's not working, I'm getting 2 spikes for some reason I can't understand as you can see in the image.

enter image description here

Here is my code:

typedef std::complex<float> Complex; Complex chunk[N]; float Fs = 176400; // How many time points are needed i,e., Sampling Frequency const double T = 1 / Fs; // At what intervals time points are sampled float value; float value2; for (int i = 0; i < N; i++) { value2 = (float)(1 * sin(2 * M_PI * 43000 * (i * T))); // Original Signal Complex value3 = {(float)(1 * sin(2 * M_PI * 12000 * (i * T))), 0}; // The frequency I want to add double multiplier = 0.5 * (1 - cos(2*M_PI*i/256)); // Hamming Window chunk[i] = {value2 * multiplier, 0 };// generate (complex) sine waveform chunk[i] = chunk[i] * value3; // Frequency Mixer } 

Frequency mixer shows 2 FFT spikes

I'm attempting to use a frequency mixer to shift one frequency range to another. Right now, I have a complex sine wave at 43KHz. My imaginary value on the complex object is 0.

If I output a frequency-amplitude spectrum it looks like this:

enter image description here

Now let's say I want to move that frequency to 65KHz. For that I realized that I need to create a new complex sine wave at that frequency and multiply it by my original signal in time.

The problem is, it's not working. I'm getting 2 spikes for some reason. I don't understand why that happens.

enter image description here

Here is my code:

typedef std::complex<float> Complex; Complex chunk[N]; float Fs = 176400; // How many time points are needed i,e., Sampling Frequency const double T = 1 / Fs; // At what intervals time points are sampled float value; float value2; for (int i = 0; i < N; i++) { value2 = (float)(1 * sin(2 * M_PI * 43000 * (i * T))); // Original Signal Complex value3 = {(float)(1 * sin(2 * M_PI * 12000 * (i * T))), 0}; // The frequency I want to add double multiplier = 0.5 * (1 - cos(2*M_PI*i/256)); // Hamming Window chunk[i] = {value2 * multiplier, 0 };// generate (complex) sine waveform chunk[i] = chunk[i] * value3; // Frequency Mixer } 
Source Link

Frequency Mixer shows 2 FFT spikes

I'm attempting to use a Frequency Mixer to shift one frequency range to another, right now, I have a complex sine wave at 43KHz, My imaginary value on the complex object is 0.

If I output a Frequency-Amplitude spectrum it looks like this:

enter image description here

Now let's say I want to move that frequency to 65KHz, for that I realized that I need to create a new complex sine wave at that frequency and multiply it by my original signal in time.

The problem is, it's not working, I'm getting 2 spikes for some reason I can't understand as you can see in the image.

enter image description here

Here is my code:

typedef std::complex<float> Complex; Complex chunk[N]; float Fs = 176400; // How many time points are needed i,e., Sampling Frequency const double T = 1 / Fs; // At what intervals time points are sampled float value; float value2; for (int i = 0; i < N; i++) { value2 = (float)(1 * sin(2 * M_PI * 43000 * (i * T))); // Original Signal Complex value3 = {(float)(1 * sin(2 * M_PI * 12000 * (i * T))), 0}; // The frequency I want to add double multiplier = 0.5 * (1 - cos(2*M_PI*i/256)); // Hamming Window chunk[i] = {value2 * multiplier, 0 };// generate (complex) sine waveform chunk[i] = chunk[i] * value3; // Frequency Mixer }