Pages: 1 [2]   Go Down
 Author Topic: What is 'spectrum' anyway? How can multiple frequencies exist in one signal?  (Read 695 times) 0 Members and 1 Guest are viewing this topic.
Offline
Sr. Member
Karma: 7
Posts: 397
 « Reply #15 on: January 23, 2013, 08:03:33 pm » Bigger Smaller Reset

Quote
Of course. But for circuit analysis, we must decompose the signal to sine waves.

Why? It is not needed for SPICE's transient analysis, which works in the time domain.
 Logged

Offline
God Member
Karma: 10
Posts: 886
 « Reply #16 on: January 23, 2013, 11:15:33 pm » Bigger Smaller Reset

When hertz and marconi (i hate Marconi with a passion, i'd have him assassinated or did it myself, he ruined science forever)  and all the others
were first trying to detect electromagnetic waves..

their generators would just produce high frequency sparks, same way you turn a light switch on and you here the noises over AM, and if you listen
carefully, less noticeable pops and pulses over FM as well.

it was not until the tuned circuit came along did things change, their transmitters would clutter up every frequency not just 1, so they were quickly
banned.

So imagine a log cake, you take a knife and you decide that a certain section of cake is going to be your "band" and you slice out a bit of cake, you're left with a gap
that gap represents your slice of spectrum you wish to use, be Radio Waves or Light Waves, they all oscillate at different frequencies,  the difference between red or green
light is simply how fast it oscillates, difference between 100khz and 100mhz you got it.

So imagine the cake, you're allowed to use that "gap" and send your data, if you try and use "more" of that gap from the log cake, you're going to start bumping into existing
log cake - i'm getting hungry not had a chocolate log cake in years!

So you oscillate on a precise frequency, and you look at the peaks and troughs of that frequency, all radio's do is detect, tune, filter and amplify, be 100mhz or 100ghz, anything
not in that "slice" is thrown away as it's not needed, most of the guts in a radio is simpy to get rid of all the other frequencies and amplify it...

 Logged

Offline
God Member
Karma: 9
Posts: 836
 « Reply #17 on: January 23, 2013, 11:25:28 pm » Bigger Smaller Reset

"It's a concept, like infinity or the infinitesimal.  You know exactly what it is, it's me not being very specific because I don't know this area very well."

You certainly don't!   I suggest you find a good book instead of expecting someone here to get you up to speed with several years of college physics in a chat room.
 Logged

Anchorage, AK
Offline
Sr. Member
Karma: 10
Posts: 492
 « Reply #18 on: January 24, 2013, 12:02:45 am » Bigger Smaller Reset

Easy, easy... :-)

I think it was meant to be a thought-provoking question, but things like that can be a distraction.  I think the OP was just trying to wrangle the discussion back on track.  No harm, no foul.

The rest of us in this chat room are here voluntarily.  If you don't feel like being an unpaid professor, don't.  No one's going to fault you.  But I appreciate the privilege to get a discussion going on complex topics.  Textbooks can't teach us everything, and the many different viewpoints are invaluable.
 Logged

Samplefinger
Offline
God Member
Karma: 8
Posts: 822
ALWAYS ASK FOR THREE. One to use. One to lose. One to abuse.
 « Reply #19 on: January 24, 2013, 12:10:06 am » Bigger Smaller Reset

"It's a concept, like infinity or the infinitesimal.  You know exactly what it is, it's me not being very specific because I don't know this area very well."

You certainly don't!   I suggest you find a good book instead of expecting someone here to get you up to speed with several years of college physics in a chat room.

That is not what I was expecting.  I was expecting someone to suggest the book.
 Logged

Latest Sampling Scores: ATXMEGA64A3U-MH x3, ATXMEGA256A3U-MH x3, SST38VF6404-90-5C-EKE x3, SST38VF6402-90-5C-EKE x3, PGA870 x3, THS770006 x3

Land of Oz
Offline
Newbie
Karma: 2
Posts: 42
I dream in Assembler
 « Reply #20 on: January 24, 2013, 01:10:06 am » Bigger Smaller Reset

Listen up.  Go read the FFT link in the Libraries section and follow the links there. There is one really very good analysis in there for a newby.
If you want some free ebooks, "The Scientists and Engineers guide to DSP" is available as a free download, but you need some Pure Math to get thru it.
Take a look at the Elektor DSP project board that started in Nov 2011, (I think).
I don't know what you're engineering background is, but for Gawd's sake get started. DSP is the last challenge left in life.
 Logged

Samplefinger
Offline
God Member
Karma: 8
Posts: 822
ALWAYS ASK FOR THREE. One to use. One to lose. One to abuse.
 « Reply #21 on: January 24, 2013, 10:09:33 am » Bigger Smaller Reset

Listen up.  Go read the FFT link in the Libraries section and follow the links there. There is one really very good analysis in there for a newby.
If you want some free ebooks, "The Scientists and Engineers guide to DSP" is available as a free download, but you need some Pure Math to get thru it.
Take a look at the Elektor DSP project board that started in Nov 2011, (I think).
I don't know what you're engineering background is, but for Gawd's sake get started. DSP is the last challenge left in life.

Which project board do you mean?  This one (currently sold out) http://www.elektor.com/products/kits-modules/modules/100126-91-elektor-dsp-radio.2210480.lynkx or a different one?

OK, I get it, it must be http://www.elektor.com/magazines/2011/may/audio-dsp-course-(1).1778257.lynkx

Weird, the chip they use is "Not Recommended for New Design" and no one on findchips.com sells it.  Not popular for some reason.

Samples are available!
 « Last Edit: January 24, 2013, 10:13:21 am by JoeN » Logged

Latest Sampling Scores: ATXMEGA64A3U-MH x3, ATXMEGA256A3U-MH x3, SST38VF6404-90-5C-EKE x3, SST38VF6402-90-5C-EKE x3, PGA870 x3, THS770006 x3

the land of sun+snow
Offline
Edison Member
Karma: 81
Posts: 2144
 « Reply #22 on: January 24, 2013, 01:01:28 pm » Bigger Smaller Reset

If you want to play with spectral analysis, you don't need an expensive controller board.
You should be able to code an FFT on an Arduino UNO and sample an audio signal using
an A/D channel.

I don't know where greywolf was referring to, there must be some FFTs somewhere on the
Arduino site. They probably won't be especially fast [like on a super fast DSP chip], but will be
fun to play with. You can make a display similar to those I linked to first post, but a little
simpler.
 Logged

Kitchen-Sink Arduino-compatible boards

Land of Oz
Offline
Newbie
Karma: 2
Posts: 42
I dream in Assembler
 « Reply #23 on: January 24, 2013, 05:29:56 pm » Bigger Smaller Reset

Oric and Joe,
the Arduino lib link is {Reference -> libraries -> Contributed Libraries -> Audio and Waveforms. Then look in FFT.
Open Music labs has done some great work. The interesting source code is in assembler, because the standard libraries are too slow.

If you look in the one of his links to http://www.alwayslearn.com/, this is the other "learning link" I was referring to.

Another useful page is DSP Guru. Just google it.
 Logged

South Texas
Offline
God Member
Karma: 8
Posts: 976
 « Reply #24 on: January 24, 2013, 06:18:35 pm » Bigger Smaller Reset

Y'all forgot about the most common, and easily analyzed bit os spectrum out there. Its called LIGHT. Amixture of many frequencies that are present in various amounts at various times. And the highly specialized recieving equipment that allows us to analyze it is our eyes.

And a spectrum anayzer gnerally is a combination sweep tuned reciever and sweep tuned filter where the signal is captured for relative intensity (or strength) and that relative intensity is displayed. They are actually quite simple devices in theory, but it does take some work to get the wide frequency range for both the reciever and filter...
 Logged

Offline
Sr. Member
Karma: 0
Posts: 302
 « Reply #25 on: April 05, 2013, 01:00:58 pm » Bigger Smaller Reset

Look at karplus strong, FM Additive and subtractive synthesis... Quite mathematical, but in in discrete time systems is somewhat simplified a bit, as you have a lot of tricks you can do , bit wise, to avoid too many computing power to multiplications and complex equations... Best is to go same way most do, when it comes to sound synthesis in uC's : Wavetables, though the DUE already does a lot ( i been playing with it as im working on something similar !
http://dubworks.blogspot.co.uk/2013/04/sinewave-generator-with-dac-of-arm.html
Code:
/* Discrete Computational Methods */

// variables accessed by the interrupt
volatile byte out_sign;
volatile boolean l;

float pi = 3.141592;
float w ;    // ψ
float yi ;
float phase;
int D = 1024;
byte sign_samp;
byte sin_data[1024];  // sine LUT Array
int icounter;
int counter2;
int testPin = 13;      // debugging pin digital pin 13
int testPin2 = 12;      // debugging pin digital pin 12
int testPin3 = 11;      // debugging pin digital pin 11
int testPin4 = 10;      // debugging pin digital pin 11
float a;
float b;

void setup()
{
fill_sinewave();       // load memory with sine table
pinMode(testPin,OUTPUT);
pinMode(testPin2,OUTPUT);
pinMode(testPin3,OUTPUT);
pinMode(testPin4,OUTPUT);
startTimer(TC1, 0, TC3_IRQn, 0x8000); //TC1 channel 0, the IRQ
// for that channel and the desired frequency - 32768 -see somewhere
// else for the reason why
analogWrite(DAC0,0);  //Duane B// this is a cheat - enable the DAC
}

void loop()
{
counter2++;           //
if (counter2 >= 0x400)
{
digitalWrite(13, l = !l); // toggle debugging pin on pin 13
counter2=0;
fill_sinewave();
}
if(b<=511)
{
b=b*pi/128;
}
else if (b>=512)
{
b=b*pi/1024;
}
{
a=2;
}
{
a=4;
}
{
a=6;
}
{
a=8;
}
digitalWrite(12, l = !l);     // toggle debugging pin on pin 12
}
/*
* Here is the table of parameters: *
ISR/IRQ TC      Channel Due   pins
TC0 TC0 0 2,      13
TC1 TC0 1 60,     61
TC2 TC0 2 58
TC3 TC1 0 none  <- this line in the example above
TC4 TC1 1 none
TC5 TC1 2 none
TC6 TC2 0 4, 5
TC7 TC2 1 3, 10
TC8 TC2 2 11, 12
*/

void startTimer(Tc *tc, uint32_t channel, IRQn_Type irq, uint32_t frequency) {
pmc_set_writeprotect(false);
pmc_enable_periph_clk((uint32_t)irq);
TC_Configure(tc, channel, TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK1);
uint32_t rc = VARIANT_MCK/8/frequency; //8 because we selected TIMER_CLOCK1 above
TC_SetRA(tc, channel, rc/2); //50% high, 50% low
TC_SetRC(tc, channel, rc);
TC_Start(tc, channel);
tc->TC_CHANNEL[channel].TC_IER=TC_IER_CPCS;
tc->TC_CHANNEL[channel].TC_IDR=~TC_IER_CPCS;
NVIC_EnableIRQ(irq);
}
// TC1 ch 0
void TC3_Handler()
{
digitalWrite(10, l = !l);    // toggle debugging pin on pin 10
TC_GetStatus(TC1, 0);
icounter++;                  // increment index
//icounter=icounter + b;         // Variable frequency with potentiometer
icounter = icounter & 0x3ff;         // limit index 0..1023
if( icounter==0x400)
{
icounter=0;
}
out_sign=sin_data[icounter];
dacc_write_conversion_data(DACC_INTERFACE, out_sign);
}

/*  Plotting Complex Sinusoids as Circular Motion  */
/*             */
/* Euler's relation graphically as it applies to sinusoids. A point
traveling with uniform velocity around a circle with radius 1 may
be represented by  */
/* eiφ = cos(φ) + i*sin(φ) */
/*   eψt=eψft    */
/* in the complex plane, where:
t is time and  is the number of revolutions per second.
e is Euler's number, the base of natural logarithms,
i is the imaginary unit, which satisfies i2 = −1, and
π is pi, the ratio of the circumference of a circle to its diameter.
(1) http://en.wikipedia.org/wiki/Sound
(2) http://en.wikipedia.org/wiki/Sound_frequency
(3) http://en.wikipedia.org/wiki/Sine_wave
(4) https://ccrma.stanford.edu/~jos/Welcome.html
(5) http://lionel.cordesses.free.fr/gpages/DDS1.pdf
*/
void fill_sinewave()
{
digitalWrite(11, l = !l);  // toggle debugging pin on pin 11
w= a*pi;
w= w/512;  // sine LUT Array D= ox8000(fs)@32Hz. use 512,as is@  64Hz(my methods to measure it were limited, so maybe someone can do it for us ?!)   The shape of the stored waveform is
// arbitrary, and can be a sinusoid, a square, sawtooth, etc
// fill the 1024 byte circular ring buffer array
for (D = 0; D <= 0x3ff; D++)
{
yi= 0x7f*sin(phase);   // try yi= 0x7f*sin(phase)-(2*cos(phase));
//  increase to 3 ? yi= A*sin(phase)- cos(phase)- cos(phase)- cos(phase);
phase=phase+w;         // 0 to 2xpi - 1/1024 increments
sign_samp=0x7f+yi;     // dc offset
sign_samp+= b;         // Add adc value; Keep it at zero for pure sine
sin_data[D]=sign_samp; // write value into array
/*
*/
}
digitalWrite(11, l = !l);  // toggle debugging pin on pin 11
}
Based on several ideas from KHM labs experiments and Duane B.
Code if far from clean ( as i said, an ongoing project, and its the only version i have available here...) but sharing it in case it useful to anyone. Id still choose the one at Duane's as a building block if you wanna take it further... I just wanted to implement and "port" the KHM version through in order to understand the implementation in the practical side  by... (what else?) Doing it !!
Duane actually has a nice option there with grain based synthesis and someone done a nice rework with it to make it variable ( The code i have there is just the basic building block of the oscillator, as ill keep sharing some more as i go on). But deffo heavy math in it !
http://rcarduino.blogspot.co.uk/2012/12/arduino-due-dds-part-1-sinewaves-and.html
 « Last Edit: April 05, 2013, 01:14:03 pm by iyahdub » Logged

10 LET Loop=Infinite
20 GO TO 10

Offline
Sr. Member
Karma: 0
Posts: 302
 « Reply #26 on: April 05, 2013, 01:12:21 pm » Bigger Smaller Reset

As it didnt allow me to put it all, here is the rest...
Code:
/* Generating/Sample discrete sinusoid */

/* Direct digital synthesis is a common technique for generating
waveforms digitally. The principles of the technique are simple and
widely applicable. You can build a DDS oscillator in hardware or in
software.
A DDS oscillator is sometimes also known as a Numerically-Controlled
Oscillator (NCO). Usually we use a Circular buffer or FIFO.
The NCO function contains a sine look-up tables (LUTs) that perform
the following functions:
sin(n) = sin(2πn/N)
where:
n = Address input to the LUT
N = Number of samples in the LUT
sin(n) = Amplitude of sine wave at (2πn/N)

Incrementing n from 0 to N causes the LUT to output one complete
cycle of amplitude values for the sine  function. The value 2πn/N
represents a fractional phase angle between 0 and 2π. The time (t)
required to increment n from 0 to N is the period of the sine
waveforms produced by the NCO function.

The LUT address is incremented once each system clock cycle by an
amount equal to the phase input. The phase angle data is accumulated
and stored in the phase accumulator register. The output of the
phase accumulator register is used to address the LUTs.
The frequency (f) of the system clock (fCLK) is fixed. Therefore,
the frequency of the sine waves is:
f = 1/t = fCLK × phase/2π. */
/*  Table Lookup */
/*The table look-up method precomputes the unique samples of every
output sinusoid at the start of the simulation, and recalls the
samples from memory as needed. Because a table of finite length
can only be constructedif all output sequences repeat, the method
requires that the period ofevery sinusoid in the output be evenly
divisible by the sample period. That is, 1/(fiTs) = ki must be
an integer value for every channel i = 1, 2, ..., N.
The table that is constructed for each channel contains ki elements.
For long output sequences, the table look-up method requires
far fewer floating-point operations than any of the other methods,
but may demand considerably more memory, especially for high
sample rates (long tables). This is the recommended method
for models that are intended to emulate or generate code for DSP
hardware, and that therefore need to be optimized for execution speed.*/
/*  Differential */
/* The differential method uses an incremental (differential) algorithm
rather than one based on absolute time.
This mode offers reduced computational load, but is subject to drift
over time due to cumulative quantization error.
Because the method is not contingent on an absolute time value,
there is no danger of discontinuity during extended operations (when
an absolute time variable might overflow). */
/* Trigonometric Function */
/*  If the period of every sinusoid in the output is evenly divisible
by the sample  period, meaning that
1/(fiTs) = ki is an integer for every output yi, then the sinusoidal
output in the ith channel is a repeating sequence with a period of
ki samples. At each sample time, the block evaluates the sine function
at the appropriate time value within the first cycle of the sinusoid.
By constraining trigonometric evaluations to the first cycle of each
sinusoid, the block avoids the imprecision of computing the sine of
very large numbers, and eliminates the possibility of discontinuity
during extended operations (when an absolute time variable might
overflow). This method therefore avoids the memory demands of the table
look-up method at the expense of many more floating-point operations. */
/*  - THE CODE -  */
/*Used the proverbial timer interrupt example code, and
the old techniques on Direct digital synthesis available at
places like
http://interface.khm.de/index.php/lab/experiments/arduino-dds-sinewave-generator/
or
http://rcarduino.blogspot.co.uk/2012/12/arduino-due-dds-part-1-sinewaves-and.html
*/
 Logged

10 LET Loop=Infinite
20 GO TO 10

Manchester (England England)
Offline
Brattain Member
Karma: 278
Posts: 25577
Solder is electric glue
 « Reply #27 on: April 05, 2013, 03:18:41 pm » Bigger Smaller Reset

Quote
What is 'spectrum' anyway?
A spectrum is a range of frequencies that is emitted or absorbed by a something.

Quote
How can multiple frequencies exist in one signal
The can.
The OP seems to think that all waves are electro magnetic. They are not. Most signals in wires are simply electric.

A frequency is something that repeats over time. However it is not defined by a single voltage point at any instant. The lowest frequency is defined as the period where a signal describes a complete sequence, such that you could take that period, shift it in time by exactly one period and the past wave shape would line up exactly with the future wave shape.

That is just the lowest frequency or fundamental. If that is a sin or cos shaped wave that is all there is to it, if not there is more than one frequency present in that signal. Any wave shape can be created by a sum of sin and cos waves at different amplitudes and frequencies. These frequencies are harmonically related to the fundamental being integer multiples of it.
 Logged

Offline
Sr. Member
Karma: 0
Posts: 302
 « Reply #28 on: April 05, 2013, 04:37:50 pm » Bigger Smaller Reset

Mike is the man to ask. Im just a student... Actually was the maths in dsp that got me more interested in using maths to solve simple things in real time circuits without recurring to the simulator lol The perks !
 Logged

10 LET Loop=Infinite
20 GO TO 10

 Pages: 1 [2]   Go Up