Sign in

username or email:

password:



Not a member?
Forgot your password?

Search compdsp



Search tips

Ads

Discussion Groups

Free Online Books

See Also

Embedded SystemsFPGA

Discussion Groups | Comp.DSP | Matlab code needed for SSB demodulation

There are 44 messages in this thread.

You are currently looking at messages 1 to .


Is this discussion worth a thumbs up?

0

Matlab code needed for SSB demodulation - Rick Lyons - 2012-06-30 05:12:00

Hi Guys,
   I'm trying to help someone understand the operation 
of a discrete single-sideband (SSB) demodulation system 
that is being proposed to replace an older analog 
SSB demodulation system.

Having not thought about SSB systems for many years, I've 
been trying to figure out how the "phasing method" of 
SSB demodulation works.  In trying to model this 
"phasing method" using Matlab, I'm producing inconsistent 
results when demodulating upper-sideband SSB signals 
compared to demodulating lower-sideband SSB signals.

In searching the Internet for tutorial SSB demodulation 
information I'm shocked at the inconsistent, contradictory, 
and ambiguous, SSB demod material that's on the 
web.  I've found no web site, including MathWorks 
'File Exchange' pages, that has helped me.

Either I'm misunderstanding the "phasing method" of 
SSB demodulation, or my Matlab code is fouled up. 
I can't figure what I'm doing wrong.

Anyway, does anyone out there have Matlab code that 
models the "phasing method" of SSB demodulation that 
they'd be willing to share with me?

Thanks,
[-Rick-]
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Matlab code needed for SSB demodulation - Tim Wescott - 2012-06-30 10:43:00



On Sat, 30 Jun 2012 02:12:35 -0700, Rick Lyons wrote:

> Hi Guys,
>    I'm trying to help someone understand the operation
> of a discrete single-sideband (SSB) demodulation system that is being
> proposed to replace an older analog SSB demodulation system.
> 
> Having not thought about SSB systems for many years, I've been trying to
> figure out how the "phasing method" of SSB demodulation works.  In
> trying to model this "phasing method" using Matlab, I'm producing
> inconsistent results when demodulating upper-sideband SSB signals
> compared to demodulating lower-sideband SSB signals.
> 
> In searching the Internet for tutorial SSB demodulation information I'm
> shocked at the inconsistent, contradictory,
> and ambiguous, SSB demod material that's on the web.  I've found no web
> site, including MathWorks 'File Exchange' pages, that has helped me.
> 
> Either I'm misunderstanding the "phasing method" of SSB demodulation, or
> my Matlab code is fouled up.
> I can't figure what I'm doing wrong.
> 
> Anyway, does anyone out there have Matlab code that models the "phasing
> method" of SSB demodulation that they'd be willing to share with me?
> 
> Thanks,
> [-Rick-]

There's at least two variants on the phasing method that I know of: the 
regular old method and the Weaver method.  The regular is where you mix 
down in quadrature right at the carrier frequency, then filter, phase 
shift, and add (or subtract) for upper (or lower) sideband.  With the 
Weaver method you put your carrier in the middle of the signal of 
interest, filter at half the desired bandwidth, then mix again with a 
signal that brings out your desired spectrum.

The regular method has the downside that you don't get complete opposite 
sideband suppression, which makes it hard to listen to a weak signal 
that's adjacent to a strong one.  The Weaver method solves this because 
the sideband you listen to is for your signal of interest, superimposed 
on what you're hearing.  But the Weaver method has a whistle at the 
second demod frequency.

Search out the Tuscon Area Packet Radio society (TAPR).  They're into all 
sorts of high-tech amateur radio these days, and if I recall correctly 
they have a software defined radio project.  If you can find software 
from them for that, it'll work right.

-- 
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Matlab code needed for SSB demodulation - Rick Lyons - 2012-07-01 06:28:00

>On Sat, 30 Jun 2012 02:12:35 -0700, Rick Lyons wrote:
>
>> Hi Guys,
>>    I'm trying to help someone understand the operation
>> of a discrete single-sideband (SSB) demodulation system that is being
>> proposed to replace an older analog SSB demodulation system.
>> 
  [Snipped by Lyons]
>
>There's at least two variants on the phasing method that I know of: the 
>regular old method and the Weaver method.  The regular is where you mix 
>down in quadrature right at the carrier frequency, then filter, phase 
>shift, and add (or subtract) for upper (or lower) sideband.  With the 
>Weaver method you put your carrier in the middle of the signal of 
>interest, filter at half the desired bandwidth, then mix again with a 
>signal that brings out your desired spectrum.
>
>The regular method has the downside that you don't get complete opposite 
>sideband suppression, which makes it hard to listen to a weak signal 
>that's adjacent to a strong one.  The Weaver method solves this because 
>the sideband you listen to is for your signal of interest, superimposed 
>on what you're hearing.  But the Weaver method has a whistle at the 
>second demod frequency.
>
>Search out the Tuscon Area Packet Radio society (TAPR).  They're into all

>sorts of high-tech amateur radio these days, and if I recall correctly 
>they have a software defined radio project.  If you can find software 
>from them for that, it'll work right.
>-- 
>Tim Wescott

Hi Tim,
   Thanks for the advice.  I'll follow it.

See Ya',
[-Rick-]

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Matlab code needed for SSB demodulation - Randy Yates - 2012-07-01 19:39:00

Tim Wescott <t...@seemywebsite.please> writes:

> On Sat, 30 Jun 2012 02:12:35 -0700, Rick Lyons wrote:
>
>> Hi Guys,
>>    I'm trying to help someone understand the operation
>> of a discrete single-sideband (SSB) demodulation system that is being
>> proposed to replace an older analog SSB demodulation system.
>> 
>> Having not thought about SSB systems for many years, I've been trying to
>> figure out how the "phasing method" of SSB demodulation works.  In
>> trying to model this "phasing method" using Matlab, I'm producing
>> inconsistent results when demodulating upper-sideband SSB signals
>> compared to demodulating lower-sideband SSB signals.
>> 
>> In searching the Internet for tutorial SSB demodulation information I'm
>> shocked at the inconsistent, contradictory,
>> and ambiguous, SSB demod material that's on the web.  I've found no web
>> site, including MathWorks 'File Exchange' pages, that has helped me.
>> 
>> Either I'm misunderstanding the "phasing method" of SSB demodulation, or
>> my Matlab code is fouled up.
>> I can't figure what I'm doing wrong.
>> 
>> Anyway, does anyone out there have Matlab code that models the "phasing
aaa>> method" of SSB demodulation that they'd be willing to share with me?
>> 
>> Thanks,
>> [-Rick-]
>
> There's at least two variants on the phasing method that I know of: the 
> regular old method and the Weaver method.  The regular is where you mix 
> down in quadrature right at the carrier frequency, then filter, phase 
> shift, and add (or subtract) for upper (or lower) sideband.  

I don't know exactly how the phase shifting and filtering 
perform part of the demodulation, but could you simply

  a) complex-mix the input signal by the carrier frequency
  b) complex-filter the result to 0 to Fb, where Fb is the
  highest modulating frequency
  c) take the real part?

-- 
Randy Yates
Digital Signal Labs
http://www.digitalsignallabs.com
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Matlab code needed for SSB demodulation - 2012-07-01 19:50:00

On Saturday, June 30, 2012 5:12:35 AM UTC-4, Rick Lyons wrote:
> Hi Guys,
>    I'm trying to help someone understand the operation 
> of a discrete single-sideband (SSB) demodulation system 
> that is being proposed to replace an older analog 
> SSB demodulation system.
> 
> Having not thought about SSB systems for many years, I've 
> been trying to figure out how the "phasing method" of 
> SSB demodulation works.  In trying to model this 
> "phasing method" using Matlab, I'm producing inconsistent 
> results when demodulating upper-sideband SSB signals 
> compared to demodulating lower-sideband SSB signals.
> 
> In searching the Internet for tutorial SSB demodulation 
> information I'm shocked at the inconsistent, contradictory, 
> and ambiguous, SSB demod material that's on the 
> web.  I've found no web site, including MathWorks 
> 'File Exchange' pages, that has helped me.
> 
> Either I'm misunderstanding the "phasing method" of 
> SSB demodulation, or my Matlab code is fouled up. 
> I can't figure what I'm doing wrong.
> 
> Anyway, does anyone out there have Matlab code that 
> models the "phasing method" of SSB demodulation that 
> they'd be willing to share with me?
> 
> Thanks,
> [-Rick-]

Seems a simple, no impairment, baseband model of SSB mod/demod of phasing method using Matlab is
trivial.  Once you've created an analytic signal from the real input (which is as simple as
using Matlab's hilbert() function in the Signal Processing Toolbox) you have the baseband SSB
signal.  Demod is simply the real part of this signal.  A passband model is almost as simple,
requiring only an up mixer like: x = real(exp(j*wc/ws*t)) where wc is the carrier freq, ws is
the sampling freq, and t a time vector.  Demod down mixer: mssbhat = exp(j*(-wc)/ws*t).

As simple as this is, in terms of your question I'm probably missing something fundamental about
what you're asking.

function [musb,mlsb,mhatu,mhatl] = demo_ssb(m)
% m is the baseband (modulating) signal

% Baseband transmitter model
musb = myhilbert(m);
mlsb = conj(musb);

% Baseband receiver model
mhatu = real(musb);
mhatl = real(mlsb);


function y = myhilbert(x)
% Note: x is a row vector and length(x) must be even
X=fft(x);
W=[1 2*ones(1,length(x)/2-1) 1 zeros(1,length(x)/2-1)];
Y = X.*W;
y = ifft(x);
return


______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Matlab code needed for SSB demodulation - robert bristow-johnson - 2012-07-01 22:31:00

On 7/1/12 7:39 PM, Randy Yates wrote:
> Tim Wescott<t...@seemywebsite.please>  writes:
>
>> There's at least two variants on the phasing method that I know of: the
>> regular old method and the Weaver method.  The regular is where you mix
>> down in quadrature right at the carrier frequency, then filter, phase
>> shift, and add (or subtract) for upper (or lower) sideband.
>
> I don't know exactly how the phase shifting and filtering
> perform part of the demodulation, but could you simply
>
>    a) complex-mix the input signal by the carrier frequency
>    b) complex-filter the result to 0 to Fb, where Fb is the
>    highest modulating frequency
>    c) take the real part?
>

i'm unfamiliar with Weaver or Tim's "regular".  i know how we did it in 
analog with ham-radio gear in the 70s.  with an IF frequency of, i 
dunno.  it's wasn't 455 kHz (that was my old shortwave radio).  i think 
it was around 3 MHz and we had a helluva sharp "crystal-lattice filter" 
with piezo "XTAL"s.

with a good baseband filter, you can do it with a *real* mix.

let xq(t) be the Hilbert transform of xi(t).  the real IF (for USB) is


    v(t)   =  xi(t)*cos(w0*t)  -  xq(t)*sin(w0*t)

           =  Re{ (xi(t) + j*xq(t)) * e^(j*w0*t) }

now you can multiply ("mix" using old-fashioned comm lingo) v(t) with 
cos(w0*t) (assuming you have no sync problem) and filter out the 
high-frequency images leaving only the base band.


    v(t)*cos(w0*t)  =  xi(t)*(cos(w0*t))^2 - xq(t)*sin(w0*t)*cos(w0*t)

             =  1/2*( xi(t) + xi(t)*cos(2*w0*t) - xq(t)*sin(2*w0*t) )

it's not hard to get xi(t) from that to an arbitrary postive limit of 
error (and some delay).

in fact, if you were to do this using complex arithmetic, from a real 
IF, v(t), you end up doing it mathematically equivalently, because you 
have to separate xi(t)*cos(w0*t) from xq(t)*sin(w0*t) and that requires 
"mixing" and filtering v(t).

to get the LSB, you start with

    v(t)   =  xi(t)*cos(w0*t)  +  xq(t)*sin(w0*t)

           =  Re{ (xi(t) - j*xq(t)) * e^(j*w0*t) }

and do the same thing.  we used to do it with an AM receiver by just 
moving our "local oscillator" frequency (that mixed it into the IF and 
that kick-ass crystal-lattice filter) just a few kHz.  and we tuned it 
by ear, because during vowels the spoken voice is a lot like the singing 
voice which is quasi-periodic and nearly harmonic.  when the frequency 
components are offset by a non-zero constant, they sound a little 
inharmonic, and that was the source of the donald duck sound.  we never 
had phase sync, so ham-radio SSB always had a little of the quack, quack 
sound.  not quite the same as a guitar phase-shifter, but it was "phasey".

without that local oscillator, SSB sounded like encrypted audio (you 
knew it was voice-related because the amplitude modulation had the 
cadence of spoken voice but it sounded like dog shit).  totally 
unintelligible as was SSB that was detuned sufficiently (the latter was 
*really* quacky.)  i wonder if there is something about the throat of 
ducks that has strong resonances ("formants" we call them) at 
frequencies not harmonically related?  how does both detuned SSB and 
ducks both have a superficially similar "quack"?


-- 

r b-j                  r...@audioimagination.com

"Imagination is more important than knowledge."


______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Matlab code needed for SSB demodulation - Rick Lyons - 2012-07-02 07:57:00

   [Snipped by Lyons]
>
>Seems a simple, no impairment, baseband model of SSB mod/demod of phasing
m>ethod using Matlab is trivial.  

Hi,
  because I'm using the dsprelated.com web site to 
access the newsgroup here, I'm unable to determine 
to whom I'm replying.

>Once you've created an analytic signal from> the real input (which is as simple as using
Matlab's hilbert() function
in> the Signal Processing Toolbox) you have the baseband SSB signal.  Demod
is> simply the real part of this signal.  A passband model is almost as
simple>, requiring only an up mixer like: x = real(exp(j*wc/ws*t)) where wc is
t>he carrier freq, ws is the sampling freq, and t a time vector.  Demod down
>mixer: mssbhat = exp(j*(-wc)/ws*t).
>
>As simple as this is, in terms of your question I'm probably missing
someth>ing fundamental about what you're asking.
>
>function [musb,mlsb,mhatu,mhatl] = demo_ssb(m)
>% m is the baseband (modulating) signal
>
>% Baseband transmitter model
>musb = myhilbert(m);
>mlsb = conj(musb);
>
>% Baseband receiver model
>mhatu = real(musb);
>mhatl = real(mlsb);
>
>
>function y = myhilbert(x)
>% Note: x is a row vector and length(x) must be even
>X=fft(x);
>W=[1 2*ones(1,length(x)/2-1) 1 zeros(1,length(x)/2-1)];
>Y = X.*W;
>y = ifft(x);
>return

What your code seems to be doing is:

  [1] Accept a real-valued baseband input 
      sequence 'm'.
  [2] Create a positive-freq-only baseband, 
      analytic, version of 'm'.
  [3] Create a negative-freq-only baseband, 
      analytic, version of 'm'.
  [4] Take the real parts of those two 
      analytic signals to duplicate the 
      original real-valued baseband 'm'.

Yep, I'll certainly agree that these operations 
are trivial.  What I'm tryin' to do is understand,
and model, the various schemes I've encountered 
on the Internet for demodulating real-valued 
bandpass SSB signals.

Thanks for your post.

[-Rick-]
PS. As far as I can tell, your 'myhilbert()' 
function does not produce the same results 
as Matlab's 'hilbert()' function.  Or am 
I missing something?


______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Matlab code needed for SSB demodulation - Rick Lyons - 2012-07-02 08:16:00

Hi Randy,

>I don't know exactly how the phase shifting and filtering 
>perform part of the demodulation, but could you simply
>
>  a) complex-mix the input signal by the carrier frequency
>  b) complex-filter the result to 0 to Fb, where Fb is the
>  highest modulating frequency
>  c) take the real part?
>
>-- 
>Randy Yates

Yes, I think you are correct.  I've modeled that 
exact process.  And because we can 
discard the imaginary part of the complex-filtering 
result, based on my modeling it seems we only need 
to perform real-valued filtering.

However, because the process described above is 
simpler than any SSB demod process I've found on 
the web, I'm suspicious that I'm doing something 
wrong in my Matlab modeling.  That's why I wanted 
to have a look at other people's SSB demod Matlab 
code and compare it with mine.

Thanks Randy,
[-Rick-]
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Matlab code needed for SSB demodulation - 2012-07-02 10:08:00

>PS. As far as I can tell, your 'myhilbert()'
>function does not produce the same results
>as Matlab's 'hilbert()' function.  Or am
>I missing something? 

Yes, it differs due to a careless typo on my part.
The line before the return statement should read:

y = ifft(Y);

instead I carelessly wrote: y = ifft(x);

With this correction results should match Matlab's hilbert() function to within rounding.

>Hi,
>  because I'm using the dsprelated.com web site to
>access the newsgroup here, I'm unable to determine
>to whom I'm replying. 

Yes, I'm a long time reader (and big fan) of your posts, books, tips and tricks etc.  I'm not
much of a poster but thought I could help out with this particular question.  I'm accessing this
forum through Google Groups which not only makes it impossible for you to know to whom you're
replying but also seems to corrupt my text with what looks like formatting characters.  Sorry
for that.

If you're still having problems and explain more about the inconsistencies you're seeing in your
model perhaps I could better help.

Sincere regards.
Mark
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Matlab code needed for SSB demodulation - Randy Yates - 2012-07-02 14:48:00

"Rick Lyons" <R...@n_o_s_p_a_m.ieee.org> writes:

> Hi Randy,
>
>>I don't know exactly how the phase shifting and filtering 
>>perform part of the demodulation, but could you simply
>>
>>  a) complex-mix the input signal by the carrier frequency
>>  b) complex-filter the result to 0 to Fb, where Fb is the
>>  highest modulating frequency
>>  c) take the real part?
>>
>>-- 
>>Randy Yates
>
> Yes, I think you are correct.  I've modeled that 
> exact process.  And because we can 
> discard the imaginary part of the complex-filtering 
> result, based on my modeling it seems we only need 
> to perform real-valued filtering.
>
> However, because the process described above is 
> simpler than any SSB demod process I've found on 
> the web, I'm suspicious that I'm doing something 
> wrong in my Matlab modeling.  That's why I wanted 
> to have a look at other people's SSB demod Matlab 
> code and compare it with mine.

Rick, maybe the hard part of the problem is FINDING THE CARRIER
FREQUENCY! I just ASSUMED one knows the carrier frequency. In reality, I
don't know what you'd do to get a carrier lock on a SSB (suppressed
carrier) signal.

> Thanks Randy,

As Robert and Fred say, FWIW, YMMV. And when are we gonna drink some
beer together?
--
Randy Yates
Digital Signal Labs
http://www.digitalsignallabs.com
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

| 1 | | 3 | 4 | 5 |