Hello All, I have probably made my first attempt to write a Matlab code. I have tried to multiply a time domain signal with complex exponential. I believe has the effect of moving the spectrum of the signal. However, I have several questions. 1) Whether the approach I have taken is correct. I can post both Matlab code and the plots. Please let me know how to post code and plot since this forum does not allow attachments. 2) I assume that by multiplying time domain signal by a complex exponential, I am converting a real signal into a complex variable. What is the point here since my original time domain signal is now appearing in a totally different domain. My initial assumption was that frequency of the signal would get increased but signal would remain in time domain. Even if time domain signal gets converted into a complex signal, how this is further processed in real applications. Whether the signal is brought back to real domain? My next plan is to plot frequency representation of the unconverted signal and see. But I wanted to make sure I am going in the right direction. If anyone can please let me know how to post code and plot, it would help ... _____________________________ Posted through www.DSPRelated.com
Multiplying time domain signal with complex exponential
Started by ●March 12, 2015
Reply by ●March 12, 20152015-03-12
On Thu, 12 Mar 2015 12:37:10 -0500, "sharanbr" <49338@dsprelated> wrote:>Hello All, > >I have probably made my first attempt to write a Matlab code. I have tried >to multiply a time domain signal with complex exponential. I believe has >the effect of moving the spectrum of the signal. > >However, I have several questions. > >1) Whether the approach I have taken is correct. I can post both Matlab >code and the plots. Please let me know how to post code and plot since this >forum does not allow attachments.If the code isn't long, sometimes posting the code, or snippets from it, in your post works. Otherwise, posting links to plots or code listings always works.>2) I assume that by multiplying time domain signal by a complex >exponential, I am converting a real signal into a complex variable. What is >the point here since my original time domain signal is now appearing in a >totally different domain. My initial assumption was that frequency of the >signal would get increased but signal would remain in time domain.Complex signals still exist in the time domain. They're just complex instead of real-only.>Even if time domain signal gets converted into a complex signal, how this >is further processed in real applications. Whether the signal is brought >back to real domain?Depending on what the applications needs or wants, when you're ready to convert back to a real-valued signal, you can take the real part of the complex signal or detect its magnitude or something else creative.>My next plan is to plot frequency representation of the unconverted signal >and see. But I wanted to make sure I am going in the right direction. > >If anyone can please let me know how to post code and plot, it would help >... > > >_____________________________ >Posted through www.DSPRelated.comEric Jacobsen Anchor Hill Communications http://www.anchorhill.com
Reply by ●March 12, 20152015-03-12
On Thu, 12 Mar 2015 12:37:10 -0500, sharanbr wrote:> Hello All, > > I have probably made my first attempt to write a Matlab code. I have > tried to multiply a time domain signal with complex exponential. I > believe has the effect of moving the spectrum of the signal. > > However, I have several questions. > > 1) Whether the approach I have taken is correct. I can post both Matlab > code and the plots. Please let me know how to post code and plot since > this forum does not allow attachments.Generally folks here won't read code for you unless it's short. Some are more willing than others -- I find it a chore, so if it's more than five lines or so I'll tell you nicely that that's what I do for a living and you can pay me. For code snippets, just cut and paste them into your post -- like this: y = x .* exp(%i * 2 * %pi * f * (1:prod(size(x)))); (Note that this will do what you're asking about IN SCILAB. I'm not sure if it'll work in Matlab, but if it doesn't it's close). For plots, turn them into gif files and find a free dropbox service somewhere. I'm lazy, so I use Google Drive.> 2) I assume that by multiplying time domain signal by a complex > exponential, I am converting a real signal into a complex variable.That is correct.> What > is the point here since my original time domain signal is now appearing > in a totally different domain.It's still the time domain, but in the complex number space instead of on the real number line. Generally you convert to complex, do some signal processing that's easier to do in the complex domain than in the real domain, then convert the result back to reals. Sometimes the conversion is as easy as ignoring the imaginary part -- but not always.> My initial assumption was that frequency > of the signal would get increased but signal would remain in time > domain.The signal remains in the time domain, but the frequency is shifted. Note that it's not necessarily always shifted up -- if your exponential has a negative frequency, your signal will be shifted down in frequency. This is a handy way to bring an RF signal down to baseband: sample it, multiply it by a complex exponential, and then low-pass filter the result (to get rid of the negative-frequency image). Then resample it at a lower rate (which you can do, because it's at baseband), play with it in the complex domain, and, finally, turn it into something real (or more often these days, extract the digital data it's carrying).> Even if time domain signal gets converted into a complex signal, how > this is further processed in real applications. Whether the signal is > brought back to real domain?See above.> My next plan is to plot frequency representation of the unconverted > signal and see. But I wanted to make sure I am going in the right > direction.You are sort of going in the right direction. I suggest that you generate a cosine with a frequency of about 1/16th sample per cycle. Make it an integer number of cycles long (e.g., make it 8 cycles long). Take it's Fourier transform, and look at the result. Now multiply it by a complex exponential at the same frequency. Take the Fourier transform of the result, and look at that. Do it again for a complex exponential at the same absolute frequency, but negative (i.e., plug in -f where you had f). Look at the result again. If the light is starting to dawn, do the same thing only start with a signal that's a sum of two or three cosine waves closely spaced in frequency, but still an integer number of cycles long, each -- say 6, 8 and 10 cycles in your vector. Make the three cosine waves of different amplitudes, so that you'll recognize them in your result.> If anyone can please let me know how to post code and plot, it would > help ..HTH. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Reply by ●March 13, 20152015-03-13
On Friday, March 13, 2015 at 9:22:16 AM UTC+13, Tim Wescott wrote:> On Thu, 12 Mar 2015 12:37:10 -0500, sharanbr wrote: > > > Hello All, > > > > I have probably made my first attempt to write a Matlab code. I have > > tried to multiply a time domain signal with complex exponential. I > > believe has the effect of moving the spectrum of the signal. > > > > However, I have several questions. > > > > 1) Whether the approach I have taken is correct. I can post both Matlab > > code and the plots. Please let me know how to post code and plot since > > this forum does not allow attachments. > > Generally folks here won't read code for you unless it's short. Some are > more willing than others -- I find it a chore, so if it's more than five > lines or so I'll tell you nicely that that's what I do for a living and > you can pay me. > > For code snippets, just cut and paste them into your post -- like this: > > y = x .* exp(%i * 2 * %pi * f * (1:prod(size(x)))); > > (Note that this will do what you're asking about IN SCILAB. I'm not sure > if it'll work in Matlab, but if it doesn't it's close). > > For plots, turn them into gif files and find a free dropbox service > somewhere. I'm lazy, so I use Google Drive. > > > 2) I assume that by multiplying time domain signal by a complex > > exponential, I am converting a real signal into a complex variable. > > That is correct. > > > What > > is the point here since my original time domain signal is now appearing > > in a totally different domain. > > It's still the time domain, but in the complex number space instead of on > the real number line. Generally you convert to complex, do some signal > processing that's easier to do in the complex domain than in the real > domain, then convert the result back to reals. Sometimes the conversion > is as easy as ignoring the imaginary part -- but not always. > > > My initial assumption was that frequency > > of the signal would get increased but signal would remain in time > > domain. > > The signal remains in the time domain, but the frequency is shifted. Note > that it's not necessarily always shifted up -- if your exponential has a > negative frequency, your signal will be shifted down in frequency. This > is a handy way to bring an RF signal down to baseband: sample it, multiply > it by a complex exponential, and then low-pass filter the result (to get > rid of the negative-frequency image). Then resample it at a lower rate > (which you can do, because it's at baseband), play with it in the complex > domain, and, finally, turn it into something real (or more often these > days, extract the digital data it's carrying). > > > Even if time domain signal gets converted into a complex signal, how > > this is further processed in real applications. Whether the signal is > > brought back to real domain? > > See above. > > > My next plan is to plot frequency representation of the unconverted > > signal and see. But I wanted to make sure I am going in the right > > direction. > > You are sort of going in the right direction. > > I suggest that you generate a cosine with a frequency of about 1/16th > sample per cycle. Make it an integer number of cycles long (e.g., make it > 8 cycles long). Take it's Fourier transform, and look at the result. > > Now multiply it by a complex exponential at the same frequency. Take the > Fourier transform of the result, and look at that. Do it again for a > complex exponential at the same absolute frequency, but negative (i.e., > plug in -f where you had f). Look at the result again. > > If the light is starting to dawn, do the same thing only start with a > signal that's a sum of two or three cosine waves closely spaced in > frequency, but still an integer number of cycles long, each -- say 6, 8 > and 10 cycles in your vector. Make the three cosine waves of different > amplitudes, so that you'll recognize them in your result. > > > If anyone can please let me know how to post code and plot, it would > > help .. > > HTH. > > -- > > Tim Wescott > Wescott Design Services > http://www.wescottdesign.comI thought exp(jwt) was a pure frequency shift ie no negative frequencies according to Fourier Transform theory. If you use a local oscillator instead ie cos(wt) then you get negative frequencies.
Reply by ●March 14, 20152015-03-14
On 14.3.15 02:22, gyansorova@gmail.com wrote:> On Friday, March 13, 2015 at 9:22:16 AM UTC+13, Tim Wescott wrote: >> On Thu, 12 Mar 2015 12:37:10 -0500, sharanbr wrote: >> >>> Hello All, >>> >>> I have probably made my first attempt to write a Matlab code. I have >>> tried to multiply a time domain signal with complex exponential. I >>> believe has the effect of moving the spectrum of the signal. >>> >>> However, I have several questions. >>> >>> 1) Whether the approach I have taken is correct. I can post both Matlab >>> code and the plots. Please let me know how to post code and plot since >>> this forum does not allow attachments. >> >> Generally folks here won't read code for you unless it's short. Some are >> more willing than others -- I find it a chore, so if it's more than five >> lines or so I'll tell you nicely that that's what I do for a living and >> you can pay me. >> >> For code snippets, just cut and paste them into your post -- like this: >> >> y = x .* exp(%i * 2 * %pi * f * (1:prod(size(x)))); >> >> (Note that this will do what you're asking about IN SCILAB. I'm not sure >> if it'll work in Matlab, but if it doesn't it's close). >> >> For plots, turn them into gif files and find a free dropbox service >> somewhere. I'm lazy, so I use Google Drive. >> >>> 2) I assume that by multiplying time domain signal by a complex >>> exponential, I am converting a real signal into a complex variable. >> >> That is correct. >> >>> What >>> is the point here since my original time domain signal is now appearing >>> in a totally different domain. >> >> It's still the time domain, but in the complex number space instead of on >> the real number line. Generally you convert to complex, do some signal >> processing that's easier to do in the complex domain than in the real >> domain, then convert the result back to reals. Sometimes the conversion >> is as easy as ignoring the imaginary part -- but not always. >> >>> My initial assumption was that frequency >>> of the signal would get increased but signal would remain in time >>> domain. >> >> The signal remains in the time domain, but the frequency is shifted. Note >> that it's not necessarily always shifted up -- if your exponential has a >> negative frequency, your signal will be shifted down in frequency. This >> is a handy way to bring an RF signal down to baseband: sample it, multiply >> it by a complex exponential, and then low-pass filter the result (to get >> rid of the negative-frequency image). Then resample it at a lower rate >> (which you can do, because it's at baseband), play with it in the complex >> domain, and, finally, turn it into something real (or more often these >> days, extract the digital data it's carrying). >> >>> Even if time domain signal gets converted into a complex signal, how >>> this is further processed in real applications. Whether the signal is >>> brought back to real domain? >> >> See above. >> >>> My next plan is to plot frequency representation of the unconverted >>> signal and see. But I wanted to make sure I am going in the right >>> direction. >> >> You are sort of going in the right direction. >> >> I suggest that you generate a cosine with a frequency of about 1/16th >> sample per cycle. Make it an integer number of cycles long (e.g., make it >> 8 cycles long). Take it's Fourier transform, and look at the result. >> >> Now multiply it by a complex exponential at the same frequency. Take the >> Fourier transform of the result, and look at that. Do it again for a >> complex exponential at the same absolute frequency, but negative (i.e., >> plug in -f where you had f). Look at the result again. >> >> If the light is starting to dawn, do the same thing only start with a >> signal that's a sum of two or three cosine waves closely spaced in >> frequency, but still an integer number of cycles long, each -- say 6, 8 >> and 10 cycles in your vector. Make the three cosine waves of different >> amplitudes, so that you'll recognize them in your result. >> >>> If anyone can please let me know how to post code and plot, it would >>> help .. >> >> HTH. >> >> -- >> >> Tim Wescott >> Wescott Design Services >> http://www.wescottdesign.com > > I thought exp(jwt) was a pure frequency shift ie no negative frequencies according to Fourier Transform theory. If you use a local oscillator instead ie cos(wt) then you get negative frequencies.You need also a complex input signal for pure frequency shift. In the days gone, it was called the phasing method of generating SSB. -- -TV
Reply by ●March 14, 20152015-03-14
Dear Eric, Tim, I will spend some more time with example based on the suggestions made here before posting the code and the plots ... A few questions based on the responses ... Eric Jacobsen - Complex signals still exist in the time domain. They're just complex instead of real-only. Is there any tradeoff of converting a real valued time domain signal into a complex signal. Can the result be converted into real signal again. My own understanding of upconverting a sinusoidal signal was that the resulting signal would have its frequency keeping the shapre same. Tim Wescott - The signal remains in the time domain, but the frequency is shifted. Note that it's not necessarily always shifted up -- if your exponential has a negative frequency, your signal will be shifted down in frequency. This is a handy way to bring an RF signal down to baseband: sample it, multiply it by a complex exponential, and then low-pass filter the result (to get rid of the negative-frequency image). Then resample it at a lower rate (which you can do, because it's at baseband), play with it in the complex domain, and, finally, turn it into something real (or more often these days, extract the digital data it's carrying). Converting RF signal down to baseband - is this step de-modulation? I assume that RF signal would have both high frequency carrier and baseband information. Would this step just get baseband information? Also, in this case, I would assume that one needs to have a high frequency exponential signal to convert RF to baseband. Is this correct? Thanks a lot for ... _____________________________ Posted through www.DSPRelated.com
Reply by ●March 14, 20152015-03-14
On Fri, 13 Mar 2015 17:22:46 -0700, gyansorova wrote:> On Friday, March 13, 2015 at 9:22:16 AM UTC+13, Tim Wescott wrote: >> On Thu, 12 Mar 2015 12:37:10 -0500, sharanbr wrote: >> >> > Hello All, >> > >> > I have probably made my first attempt to write a Matlab code. I have >> > tried to multiply a time domain signal with complex exponential. I >> > believe has the effect of moving the spectrum of the signal. >> > >> > However, I have several questions. >> > >> > 1) Whether the approach I have taken is correct. I can post both >> > Matlab code and the plots. Please let me know how to post code and >> > plot since this forum does not allow attachments. >> >> Generally folks here won't read code for you unless it's short. Some >> are more willing than others -- I find it a chore, so if it's more than >> five lines or so I'll tell you nicely that that's what I do for a >> living and you can pay me. >> >> For code snippets, just cut and paste them into your post -- like this: >> >> y = x .* exp(%i * 2 * %pi * f * (1:prod(size(x)))); >> >> (Note that this will do what you're asking about IN SCILAB. I'm not >> sure if it'll work in Matlab, but if it doesn't it's close). >> >> For plots, turn them into gif files and find a free dropbox service >> somewhere. I'm lazy, so I use Google Drive. >> >> > 2) I assume that by multiplying time domain signal by a complex >> > exponential, I am converting a real signal into a complex variable. >> >> That is correct. >> >> > What is the point here since my original time domain signal is now >> > appearing in a totally different domain. >> >> It's still the time domain, but in the complex number space instead of >> on the real number line. Generally you convert to complex, do some >> signal processing that's easier to do in the complex domain than in the >> real domain, then convert the result back to reals. Sometimes the >> conversion is as easy as ignoring the imaginary part -- but not always. >> >> > My initial assumption was that frequency of the signal would get >> > increased but signal would remain in time domain. >> >> The signal remains in the time domain, but the frequency is shifted. >> Note that it's not necessarily always shifted up -- if your exponential >> has a negative frequency, your signal will be shifted down in >> frequency. This is a handy way to bring an RF signal down to baseband: >> sample it, multiply it by a complex exponential, and then low-pass >> filter the result (to get rid of the negative-frequency image). Then >> resample it at a lower rate (which you can do, because it's at >> baseband), play with it in the complex domain, and, finally, turn it >> into something real (or more often these days, extract the digital data >> it's carrying). >> >> > Even if time domain signal gets converted into a complex signal, how >> > this is further processed in real applications. Whether the signal is >> > brought back to real domain? >> >> See above. >> >> > My next plan is to plot frequency representation of the unconverted >> > signal and see. But I wanted to make sure I am going in the right >> > direction. >> >> You are sort of going in the right direction. >> >> I suggest that you generate a cosine with a frequency of about 1/16th >> sample per cycle. Make it an integer number of cycles long (e.g., make >> it 8 cycles long). Take it's Fourier transform, and look at the >> result. >> >> Now multiply it by a complex exponential at the same frequency. Take >> the Fourier transform of the result, and look at that. Do it again for >> a complex exponential at the same absolute frequency, but negative >> (i.e., plug in -f where you had f). Look at the result again. >> >> If the light is starting to dawn, do the same thing only start with a >> signal that's a sum of two or three cosine waves closely spaced in >> frequency, but still an integer number of cycles long, each -- say 6, 8 >> and 10 cycles in your vector. Make the three cosine waves of different >> amplitudes, so that you'll recognize them in your result. >> >> > If anyone can please let me know how to post code and plot, it would >> > help .. >> >> HTH. >> >> -- >> >> Tim Wescott Wescott Design Services http://www.wescottdesign.com > > I thought exp(jwt) was a pure frequency shift ie no negative frequencies > according to Fourier Transform theory. If you use a local oscillator > instead ie cos(wt) then you get negative frequencies.exp(jwt) is a complex signal. Multiplying by exp(jwt) causes a pure frequency shift no matter what. I suggested the OP start with cos(wt), which has spectral content at wt and -wt -- that's where the (implied) negative frequencies in my example come from. -- www.wescottdesign.com
Reply by ●March 14, 20152015-03-14
On Sat, 14 Mar 2015 12:46:38 -0500, sharanbr wrote:> Dear Eric, Tim, > > I will spend some more time with example based on the suggestions made > here before posting the code and the plots ... > > A few questions based on the responses ... > > Eric Jacobsen - > Complex signals still exist in the time domain. They're just complex > instead of real-only. > > Is there any tradeoff of converting a real valued time domain signal > into a complex signal. Can the result be converted into real signal > again.Usually there's a tradeoff. You gain an overall savings in computational effort. There's a cost of (a) having to deal with complex numbers (or inphase-quadrature pairs, which is how some folk prefer to think of it once it's in hardware) and (b) having to do all of your design with complex numbers. If you preserve all the information in the original signal (and yes, you can destroy it if you do your job wrong) then you can always get it back.> My own understanding of upconverting a sinusoidal signal was that the > resulting signal would have its frequency keeping the shapre same. > > Tim Wescott - > > The signal remains in the time domain, but the frequency is shifted. > Note > > that it's not necessarily always shifted up -- if your exponential has a > negative frequency, your signal will be shifted down in frequency. This > is a handy way to bring an RF signal down to baseband: sample it, > multiply it by a complex exponential, and then low-pass filter the > result (to get rid of the negative-frequency image). Then resample it > at a lower rate (which you can do, because it's at baseband), play with > it in the complex domain, and, finally, turn it into something real (or > more often these days, extract the digital data it's carrying). > > Converting RF signal down to baseband - is this step de-modulation?Not really, no, if for no other reason that what you have at baseband is a complex signal, and you just want one real signal.> I assume that RF signal would have both high frequency carrier and > baseband information. Would this step just get baseband information?That depends on the signal and what you do with it. Generally what it does is to bring the high frequency carrier to zero, but still leaves the signal with whatever sort of modulation it had to start with.> Also, in this case, I would assume that one needs to have a high > frequency exponential signal to convert RF to baseband. Is this correct?In practice one does not really multiply by a complex signal, because such signals don't exist. Instead, one multiplies by an inphase- quadrature pair (i.e., cos(wt) and sin(wt)). Then, for the purposes of doing computation, one calls the inphase channel "real" and the quadrature channel "imaginary". It might be very useful to all concerned if you would tell us what you're trying to accomplish by all of this -- having a specific example to hang our hats on, rather than worrying about the roof of a building that, apparently, does not have a foundation, would go a long way to grounding the discussion. Alternately, a search on "the phasing method of SSB reception" might give you some examples of early, concrete, useful example of quadrature downconversions. (Early as in it worked perfectly well with vacuum tubes, in the 1950's). -- www.wescottdesign.com
Reply by ●March 14, 20152015-03-14
Hint, trying to anticipate your problem: A complex baseband-equivalent signal is by definition the _positive_ frequency component of a (radio frequency) signal centered around some carrier. Multiply it with a complex exponential and you get a frequency shift as expected. Now a typical real-valued signal (say, audio) includes positive _and_ negative frequencies. Multiplying with a complex exponential shifts _both_ in the same direction, which usually doesn't make too much sense. One search term of interest is "analytical" signals: how to get rid of the unwanted half of the spectrum. The "SSB" method is pretty much the same, more or less, and "Hilbert transform" is one way to do it. _____________________________ Posted through www.DSPRelated.com
Reply by ●March 14, 20152015-03-14
On Sat, 14 Mar 2015 12:46:38 -0500, "sharanbr" <49338@dsprelated> wrote:>Dear Eric, Tim, > >I will spend some more time with example based on the suggestions made here >before posting the code and the plots ... > >A few questions based on the responses ... > >Eric Jacobsen - >Complex signals still exist in the time domain. They're just complex >instead of real-only. > >Is there any tradeoff of converting a real valued time domain signal into a >complex signal. Can the result be converted into real signal again.One benefit of complex mixing operation compared to using a real-valued LO is image suppression. If you use a real-valued mixing LO you will wind up with what are usually referred to as high- and low-side products. If you only need to shift the frequency a little bit those products can overlap, which is often undesirable. A complex mixing operation shifts the entire spectrum equally, even the negative frequencies, in the same direction. There are no overlap problems, and you can shift it as much as you want up or down as long as you can generate the complex tone accurately. So that's part of the benefit of using a complex mix to convert the mixed real signal to complex; you can suppress images and have more control over the amount of shift. In general converting to complex values can make it easier to process and use phase, and it also allows the use of negative frequencies without much trouble. Basically, depending on what you're doing, there can be tons of advantages to using complex values. Many communications, sensing, and imaging applications routinely use complex values because of the various advantages that can be gained.>My own understanding of upconverting a sinusoidal signal was that the >resulting signal would have its frequency keeping the shapre same.Done properly, there is no loss of information when performing a complex mix. Likewise with a real-valued mix, but there are more constraints on what you can do.>Tim Wescott - > >The signal remains in the time domain, but the frequency is shifted. Note > >that it's not necessarily always shifted up -- if your exponential has a >negative frequency, your signal will be shifted down in frequency. This >is a handy way to bring an RF signal down to baseband: sample it, multiply >it by a complex exponential, and then low-pass filter the result (to get >rid of the negative-frequency image). Then resample it at a lower rate >(which you can do, because it's at baseband), play with it in the complex >domain, and, finally, turn it into something real (or more often these >days, extract the digital data it's carrying). > >Converting RF signal down to baseband - is this step de-modulation?Many people call that demodulation, but many other people reserve that word for extracting the information carried in the signal. It is one of those ambiguous or overloaded terms that you often have to clarify what the speaker means when they say it.>I assume that RF signal would have both high frequency carrier and baseband >information. Would this step just get baseband information?Not quite sure what you mean by this.>Also, in this case, I would assume that one needs to have a high frequency >exponential signal to convert RF to baseband. Is this correct?The amount of frequency shift is equal to frequency of the complex mixing signal, so if you want to directly convert a signal from 3.1415GHz to complex baseband, you need a 3.1415GHz complex mixing tone.>Thanks a lot for ... > >_____________________________ >Posted through www.DSPRelated.comEric Jacobsen Anchor Hill Communications http://www.anchorhill.com






