Disclaimer: this may be a tiny bit off topic for this group.
Now DSP is one of the things that I'm planning to dive deep into at some po int. So I know I'm going to get a bunch of those "Get a DSP book". But sinc e I'm going to be working on an AM radio, I decided I would like to underst and the mixing process better and demonstrate it in software in a burn befo re you learn way.
So I fired up Scilab and did the following:
1- create a time array 2- create a bunch of sinusoids at frequencies from 550khz o 1700 khz spaced by 20khz and random phase. 3- Sum all of these sinusoids to create a composite wave. 4- perform FFT on the composite wave. 5- Plot the resultsThe code is here, if anyone is interested.
Now I have to tell you I was a bit surprised by the result. I started playi ng with both sampling rate and and found the results quite interesting.
This is a picture of the FFT plot with the sampling rate a bit above Nyquis t at 4M samples/s (Max AM frequency is 1.7MHz)
Now you can see 58 sinusoids which is the correct number created in the tim e domain, but I expected them to have equal amplitudes. I assume the decrea sing amplitude is an artifact of the low sampling rate.
When I increase the sampling rate 10 times more and decrease the time to ac count for memory shortage, I got what I wanted. 58 sin waves with equal amp litude.
So far my signal sampling time window was 1 ms. As I decrease this further, I start getting more noise in the amplitudes of the sin waves. For example here with a time of 100 us.
It eventually reaches a point where the sinusoids are completely messed up, even at only half the previous time window 50 us and even with a 400M sam ples per second rate, much higher than nyquist.
I am sure there is a DSP explanation for all this. It gives me some motivat ion to study further. One possibility with relatively short time windows is that you don't have enough time to capture all the information in the sign al that it can't yet be approximated with a sin wave in the discreet domain . Another possibility is that may be there has to be some relation that nee ds to be maintained between time window and sampling rate. Don't know.
Next on my plate is to do actual mixing with a sinusoids then do some filte ring then another step of down-conversion and demodulation. I have no idea how to do digital filtering in scilab yet but I'll find out.
It was interesting to me, thought It's worth sharing and may be I can get s ome hints.