Create a Perfect Signal with Sine Wave Summation: A Step-by-Step Guide

In summary: You need to have more points in your spectrum in order to recreate the amplitude of the components. If you are using an FFT, the number of points will affect the accuracy of the amplitude calculation.
  • #1
Sam Smith
37
0
Hi

I just wanted to check my approach. I have spectrum I have peak at 10Hz another at 20Hz and a third at 30Hz. The amplitudes are 1000, 500, 250. I want to recreate the signal by summing sine waves.

I assume that I will therefore take
A1 = 1;
A2 = 0.5;
A3 = 0.25;

I will then let y = A1*Sin(2*pi*1000*t)+A2*Sin(2*pi*2*500)+A3*Sin(2*pi*3*250);

Is this correct because when I look at my end result it is not as I wish it to be.

Sorry for mistake in post due to my english
 
Physics news on Phys.org
  • #2
I think you forgot the t variable in the second and third terms, right?

And shouldn't the A1, A2, A3 be 1000, 500, 250 instead of what you wrote?

And lastly, the arguments for the sin terms should be of the form \omega * t and should somehow reflect the 10, 20, 30 hertz values not the amplitudes, right?
 
  • #3
Do you know the phases between the waves?
 
  • #4
Sam Smith said:
I will then let y = A1*Sin(2*pi*1000*t)+A2*Sin(2*pi*2*500)+A3*Sin(2*pi*3*250);

Is this correct because when I look at my end result it is not as I wish it to be.
Besides the missing factor of ##t##, why did you put those red factors in? They shouldn't be there.
 
  • #5
Hey yea sorry I did include errors in my original post so what I actuallly have is

y = A1*Sin(2*pi*10*t)+A2*Sin(2*pi*20t)+A3*Sin(2*pi*30t);

the 2 and 3 reflect that they are second and thrid harmonic?

Also have I determined my amplitudes correctly?
 
Last edited:
  • #6
If I remember correctly, the resultant amplitude by Fourier analysis should be near
gif.gif
 
  • #7
Sorry for the error above. I have corrected it now. I should not include the 2 and 3 if I also use the new frequencies. If I stay with f1 then I can use 2 and 3. Sorry I know this but I made mistake when typing up my question. So basically I have made my time series by using the above equation. I have done it in two axes however, when I plot them against each other I do not get shape I was expecting and so this make me think I have not done synthesis correctly?
 
  • #8
The 2 and 3 should not be there, the fact that they are harmonics in this particular case does not affect the way you sum the components of the signal.
 
  • #9
f95toli said:
The 2 and 3 should not be there, the fact that they are harmonics in this particular case does not affect the way you sum the components of the signal.
Yes agreed I am now plotting ;

y(t) = A1*Sin(2*pi*10*t)+A2*Sin(2*pi*20t)+A3*Sin(2*pi*30t);
 
  • #10
Sam Smith said:
when I plot them against each other I do not get shape I was expecting and so this make me think I have not done synthesis correctly?
And why should you? You don't have enough data to recreate signal waveform ( not even aproximately) .
Zillions of combinations are possible to produce peaks you're referring to...
 
  • #11
Yes I know. I have been asked ot do it as a rough guide and I am really struggling. Of course I realize that I can also have bcos(wt) in my equations. It is very tricky problem but I real appreciate you to help me! Thank you
 
  • #12
You can always reproduce the time domain signal from the spectra assuming you've captured data with enough bandwidth; what you lose with an ordinary spectra (i.e. something measured with an ordinary fft analyzer) is the relative phase of the components of the signal.
After all, if you have the spectra a simple inverse transform (ifft) will give you the time domain data.

However, coming back to the question: are you sure the spectra shows the correct amplitude of the components? Most (albeit not all) spectra actually shows the power in each peak, usually as power spectral density. You also need to be careful about the number of points in the spectra; if the measurement is fft based (which most are) you will run into trouble with the amplitudes being wrong if not enough points were used. This is a well-known artifact of the fft algorithm (which can be solved using e.g. zero-padding)
 
  • #13
Hi, Well I have quite a bit of data and I am using FFT which I believ gives (absolute magnitude or amplitude) This is correct? I have not use Spectrograph or power spectra? I also realize I should use cosine really to deal with phase but I am not sure how to determine corret combination
 
  • #14
The FFT is in general a complex function. You know what a complex number is, right? The real part of the peak value tells you about the cosine component and the imaginary part tells you about the sine component.

The sample rate needs to be higher than twice the bandwidth of the signal for you to reconstruct the signal from the FFT. But if you are simply trying to reconstruct the sample points, that won't be an issue.
 
  • #15
Ahh Ok that is very helpful and so if I look at these values and say the values at 20Hz is some 0.52 + 0.99i (made up) I then use 0.52 as my a coefficient for the cosine part and 0.99 for the sine part?
 
  • #16
Not quite. In general, you have to look at both positive and negative frequency components of the FFT. If you know that the original signal is real, then you can ignore the negative frequency components (which will just be equal to the complex conjugate of the positive frequency component. For your example, at -20Hz, you should have 0.52 - 0.99i.)
You need to multiply the number at +20Hz by 2 since you are throwing away the -20Hz value.
So 0.52*2 for the coefficient for the cosine, and 0.99*2 for the sine.

Also, depending on how the FFT routine is normalized, you might need to also multiply by another number. FFT routines are all different in how they normalize the output!
 
  • #17
Khashishi said:
Not quite. In general, you have to look at both positive and negative frequency components of the FFT. If you know that the original signal is real, then you can ignore the negative frequency components (which will just be equal to the complex conjugate of the positive frequency component. For your example, at -20Hz, you should have 0.52 - 0.99i.)
You need to multiply the number at +20Hz by 2 since you are throwing away the -20Hz value.
So 0.52*2 for the coefficient for the cosine, and 0.99*2 for the sine.

Also, depending on how the FFT routine is normalized, you might need to also multiply by another number. FFT routines are all different in how they normalize the output!

Of course, this depends on how the spectrum was reported. The OP may be looking at either a one- or two-sided spectrum, so whether there is a factor of two depends on that.

Also, in my experience, working with both sines and cosines in this sort of thing can be obnoxious. It may simply be easier to assign the complex magnitude of the FFT at a particular frequency to the amplitude of the cosine term and then take the argument of the FFT at that point and incorporate it as a phase shift.

For example, if you are trying to reconstruct ##x(t)## from its Fourier components ##X(f)##, then ##X## is complex and at a given frequency ##f_0##,
[tex]X(f_0) = a(f_0) + ib(f_0).[/tex]
You can then get the sinusoidal component for ##f_0## from
[tex]x_0(t) = A_0 \cos (2\pi f_0 t + \phi_0)[/tex]
where
[tex]A_0 = |X(f_0)| = |a(f_0) + ib(f_0)|[/tex]
and
[tex]\phi_0 = \arg X(f_0) = \arctan\dfrac{b(f_0)}{a(f_0)}.[/tex]

And of course, there may be a factor of two involved depending on the nature of the spectrum OP is reading.
 
  • #18
Thank you for the help I am trying to get the complex values at present out of the spectra that I have been given. The amplitudes are just real numbers however it seems that it fft has been used and then (abs(fft)) is plotted to give the spectra
 
  • #19
boneh3ad said:
Of course, this depends on how the spectrum was reported. The OP may be looking at either a one- or two-sided spectrum, so whether there is a factor of two depends on that.

Also, in my experience, working with both sines and cosines in this sort of thing can be obnoxious. It may simply be easier to assign the complex magnitude of the FFT at a particular frequency to the amplitude of the cosine term and then take the argument of the FFT at that point and incorporate it as a phase shift.

For example, if you are trying to reconstruct ##x(t)## from its Fourier components ##X(f)##, then ##X## is complex and at a given frequency ##f_0##,
[tex]X(f_0) = a(f_0) + ib(f_0).[/tex]
You can then get the sinusoidal component for ##f_0## from
[tex]x_0(t) = A_0 \cos (2\pi f_0 t + \phi_0)[/tex]
where
[tex]A_0 = |X(f_0)| = |a(f_0) + ib(f_0)|[/tex]
and
[tex]\phi_0 = \arg X(f_0) = \arctan\dfrac{b(f_0)}{a(f_0)}.[/tex]

And of course, there may be a factor of two involved depending on the nature of the spectrum OP is reading.
Thank you so much, I have just a single sided spectra. The amplitudes have been given to me in real numbers (I don't see a complex part) and I have values up to 100Hz but the sample rate was 200Hz
 
  • #20
Sam Smith said:
Thank you so much, I have just a single sided spectra. The amplitudes have been given to me in real numbers (I don't see a complex part) and I have values up to 100Hz but the sample rate was 200Hz

Ask whoever gave you the spectrum if he/she can provide the complex values for you. You'll need that for phase information.
 
  • #21
AH Ok they have provided me with the original code. And their spectra is based on the abs of the FFT. so I am guessing if I exclude that abs I should have the complex numbers?
 
  • #22
Hi everyone after researching this proble more thoroughly I have decided to use the complex amplitudes to give me the amplitudes for cos and sin however I was wondering if you guys could tell me if my approach is correct. I take the fft data (I have removed abs so that I get complex data) I then get values such as this -3.25e+002 + 4.56e+002i;

I then recreate using the formula

y(t) = -3.25e+002*cos(2*pi*f1*t)+4.56e+002*sin(2*pi*f1*t) ;

This is just an example, usually I have a fundamental frequency and lots of harmonics present. However this approach si not quite recreating the shapes that I would expect. Am I doing somethign wrong in my approach?
 

1. What is the purpose of creating a perfect signal using sine wave summation?

The purpose of creating a perfect signal using sine wave summation is to generate a waveform that is free from any distortion or noise. This type of signal is commonly used in telecommunications, audio engineering, and other fields where accuracy and precision are crucial.

2. What is the first step in creating a perfect signal with sine wave summation?

The first step is to determine the frequency and amplitude of the individual sine waves that will be used in the summation. This can be done by analyzing the desired signal and breaking it down into its component frequencies.

3. How many sine waves are needed to create a perfect signal?

The number of sine waves needed will vary depending on the complexity of the desired signal. In general, a larger number of sine waves will result in a more accurate and precise signal.

4. Can any type of signal be created using sine wave summation?

No, sine wave summation is best suited for creating periodic signals with a consistent frequency and amplitude. It may not be suitable for creating signals with irregular or non-periodic patterns.

5. What are some potential challenges when creating a perfect signal with sine wave summation?

One potential challenge is accurately determining the frequencies and amplitudes of the individual sine waves needed for the summation. Another challenge may be avoiding interference between the individual sine waves, which can result in distortion of the final signal.

Similar threads

  • General Math
Replies
7
Views
2K
  • General Math
Replies
1
Views
738
Replies
2
Views
2K
  • Other Physics Topics
Replies
17
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
11
Views
2K
  • Introductory Physics Homework Help
Replies
9
Views
1K
  • Introductory Physics Homework Help
Replies
3
Views
945
  • Introductory Physics Homework Help
Replies
11
Views
758
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
Replies
1
Views
1K
Back
Top