I How can I amplify and shift the phases of a complex waveform in MATLAB?

  • I
  • Thread starter Thread starter Natalie Johnson
  • Start date Start date
  • Tags Tags
    Complex Waveform
AI Thread Summary
The discussion centers on manipulating a complex waveform in MATLAB to achieve specific amplitude and phase adjustments. The user aims to amplify the waveform and shift its phase, proposing a mathematical representation for these changes. However, confusion arises regarding the implications of applying different phase shifts and amplitudes to each sample, as this can distort the frequency spectrum. Additionally, the user reports issues with not obtaining even-order harmonics at 28 MHz when working with a 14 MHz signal, leading to questions about the nature of the input signal and potential artifacts in the Fourier transform process. The conversation highlights the importance of understanding the underlying signal characteristics and the effects of windowing on frequency analysis.
Natalie Johnson
Messages
38
Reaction score
0
I have a complex waveform in MATLAB that is of the form

y = A1 ei * 2 * π * f * t + Φ

I need to amplify each sample point of the waveform to an amplitude A2 and also for it to shift phase by φ. I therefore construct a complex waveform for amplification

y = (A2 / A1 ) ei+φ

Then with multiplication to give the amplified waveform

y = A2 ei*2*π*f*t+Φ ⋅ ei+φ

Is this correct?

Each point on the waveform must be multiplied by a different amplitude and phase. I have the amplitudes and phase in matricies so I am hoping if I just create an amplification waveform like above then I can just multiply into my waveform to get the final amplified waveform.
 
Physics news on Phys.org
I am assuming you mean ##y=A_2e^{i(2\pi f t+\Phi)}e^{i\phi}##, right? If so, yes this is correct, you would multiply your original function through by ##\frac{A_2}{A_1}e^{i\phi}##.
I am not sure how Matlab deals with complex numbers, but if you are to multiply a complex function by ##e^{i\phi}##, it may be required to multiply by ##cos{\phi}+i sin{\phi}##, instead of ##e^{i\phi}##.. (This is the case in C for instance, when using standard libraries)
 
Last edited:
  • Like
Likes Natalie Johnson
Your description is confusing to me.

You have a waveform digitised in the time domain. The discrete Fourier transform of that time series will be in the frequency domain, as the discrete phasors, or amplitude and phase of the spectrum.

Application of an amplitude variation to a waveform or spectrum is simple multiplication, but different phase for each point in the time domain is not. A phase shift in the time domain requires a single frequency be present or that the sample window is shifted. If you apply a different phase and amplitude change to each sample in the time domain you will be distorting the frequency axis of the spectrum, which is one weird way of generating a logarithmic frequency axis.

Filtering involves multiplying the spectrum of the waveform by the transfer function of the filter, then inverse Fourier transforming back to a time domain waveform.

If the filter transfer function was represented by a waveform in the time domain, then filtering of the signal waveform by filter waveform would be convolution in the time domain.

Natalie Johnson said:
Each point on the waveform must be multiplied by a different amplitude and phase. I have the amplitudes and phase in matricies so I am hoping if I just create an amplification waveform like above then I can just multiply into my waveform to get the final amplified waveform.
I believe you may be describing convolution in the time domain, not multiplication in the time domain.
Multiplication in the frequency domain is convolution in the time domain.

What are you actually trying to do? Filter, convolve or distort the frequency axis?
 
  • Like
Likes Natalie Johnson
muscaria said:
I am assuming you mean ##y=A_2e^{i(2\pi f t+\Phi)}e^{i\phi}##, right? If so, yes this is correct, you would multiply your original function through by ##\frac{A_2}{A_1}e^{i\phi}##.
I am not sure how Matlab deals with complex numbers, but if you are to multiply a complex function by ##e^{i\phi}##, it may be required to multiply by ##cos{\phi}+i sin{\phi}##, instead of ##e^{i\phi}##.. (This is the case in C for instance, when using standard libraries)

Hi, Yes that is what I meant. I've tried both notation and they produce the same result in MATLAB.

But I am not getting even order harmonics with either method, my frequency is at 14 MHz. I get harmonics at 42 but not at 28 MHz. Can you advise?

Baluncore said:
Your description is confusing to me.

You have a waveform digitised in the time domain. The discrete Fourier transform of that time series will be in the frequency domain, as the discrete phasors, or amplitude and phase of the spectrum.

Application of an amplitude variation to a waveform or spectrum is simple multiplication, but different phase for each point in the time domain is not. A phase shift in the time domain requires a single frequency be present or that the sample window is shifted. If you apply a different phase and amplitude change to each sample in the time domain you will be distorting the frequency axis of the spectrum, which is one weird way of generating a logarithmic frequency axis.

Filtering involves multiplying the spectrum of the waveform by the transfer function of the filter, then inverse Fourier transforming back to a time domain waveform.

If the filter transfer function was represented by a waveform in the time domain, then filtering of the signal waveform by filter waveform would be convolution in the time domain.I believe you may be describing convolution in the time domain, not multiplication in the time domain.
Multiplication in the frequency domain is convolution in the time domain.

What are you actually trying to do? Filter, convolve or distort the frequency axis?
Hi, If I had this waveform
##y=A_1e^{i(2\pi f t+\Phi)}##
and wanted to adjust its phase by \phi, then
##y=A_1e^{i(2\pi f t+\Phi)}e^{i\phi}##

If I had the waveform
##y=A_1e^{i(2\pi f t+\Phi)}##
and wanted to adjust its amplitude to a specific value which is A_2, and also adjust the phase by \phi
then
##y=A_1e^{i(2\pi f t+\Phi)} (A_2 / A_1) e^{i\phi}##

The frequency domain looks okay after using this method, but for one issue...

I am not getting even order harmonics with either method, my frequency is at 14 MHz. I get harmonics at 42 but not at 28 MHz. Can you advise?
 
Are you sure that such a harmonic exists in your signal? That's certainly possible.
 
Natalie Johnson said:
I am not getting even order harmonics with either method, my frequency is at 14 MHz. I get harmonics at 42 but not at 28 MHz. Can you advise?
We have no idea of what your signals look like. Do you generate simulated plots in dBm that have an obvious computational noise floor? What is the spectrum of your input signal? and the output signal? How do they compare?

If you get the spectrum by taking an FFT without first applying a window function, your f2 may fall in a deep null. That is especially true with numerical simulation where signals are perfect sub-multiples of the time window.

You might test it by offsetting your 14 MHz input frequency by a few cycles in the time window, then seeing if you get a variation in harmonic amplitudes that is dependent on the slight frequency difference.
 
You also haven't told us anything about the source of this signal. Is it synthetic or measured data of some kind? What phenomenon was it measuring or simulating (or was it purely concocted for testing purposes based on nothing physical)?

For example, if you look at the spectrum of a square wave, it shouldn't have any even harmonics, so maybe you are seeing proper behavior.
 
Back
Top