Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
FSK on a sine wave

Subject: FSK on a sine wave

From: jessica david

Date: 12 Mar, 2011 21:32:04

Message: 1 of 4

ok i need to do FSK on a sine wave, but i keep getting an error saying

" ??? Error using ==> dpskmod at 41
Elements of input X must be integers in the range [0, M-1].

Error in ==> dpskmodulation at 15
sig = dpskmod(x,M,pi / 8 ) ; "


my code is as follows:


M = 4; % Use DQPSK in this example, so M is 4.
Fs = 100;
t = [0:2*Fs+1]'/Fs;
Fc = 10; % Carrier frequency
x = sin(2*pi*t); % Sinusoidal signal
figure(1)
plot(t, x);

sig = dpskmod(x,M,pi / 8 ) ;
figure(2)
plot(y) % Plot all points, using lines to connect them.

Subject: FSK on a sine wave

From: Wayne King

Date: 12 Mar, 2011 22:04:05

Message: 2 of 4

"jessica david" wrote in message <ilgook$g9d$1@fred.mathworks.com>...
> ok i need to do FSK on a sine wave, but i keep getting an error saying
>
> " ??? Error using ==> dpskmod at 41
> Elements of input X must be integers in the range [0, M-1].
>
> Error in ==> dpskmodulation at 15
> sig = dpskmod(x,M,pi / 8 ) ; "
>
>
> my code is as follows:
>
>
> M = 4; % Use DQPSK in this example, so M is 4.
> Fs = 100;
> t = [0:2*Fs+1]'/Fs;
> Fc = 10; % Carrier frequency
> x = sin(2*pi*t); % Sinusoidal signal
> figure(1)
> plot(t, x);
>
> sig = dpskmod(x,M,pi / 8 ) ;
> figure(2)
> plot(y) % Plot all points, using lines to connect them.

Hi Jessica, dpskmod() is designed to work on the baseband digital signal, not on the signal modulated by the carrier. You want to input the baseband digital signal. Also, dpskmod is obsolete so you want to use modem.dpskmod.

Wayne

Subject: FSK on a sine wave

From: jessica david

Date: 12 Mar, 2011 23:25:05

Message: 3 of 4

"Wayne King" <wmkingty@gmail.com> wrote in message <ilgqkk$f4n$1@fred.mathworks.com>...
> "jessica david" wrote in message <ilgook$g9d$1@fred.mathworks.com>...
> > ok i need to do FSK on a sine wave, but i keep getting an error saying
> >
> > " ??? Error using ==> dpskmod at 41
> > Elements of input X must be integers in the range [0, M-1].
> >
> > Error in ==> dpskmodulation at 15
> > sig = dpskmod(x,M,pi / 8 ) ; "
> >
> >
> > my code is as follows:
> >
> >
> > M = 4; % Use DQPSK in this example, so M is 4.
> > Fs = 100;
> > t = [0:2*Fs+1]'/Fs;
> > Fc = 10; % Carrier frequency
> > x = sin(2*pi*t); % Sinusoidal signal
> > figure(1)
> > plot(t, x);
> >
> > sig = dpskmod(x,M,pi / 8 ) ;
> > figure(2)
> > plot(y) % Plot all points, using lines to connect them.
>
> Hi Jessica, dpskmod() is designed to work on the baseband digital signal, not on the signal modulated by the carrier. You want to input the baseband digital signal. Also, dpskmod is obsolete so you want to use modem.dpskmod.
>
> Wayne

what do you mean by "input the baseband digital signal."?
if I cannpt use dpskmod, how can i digitall modulate a sine wave
 I know it sounds silly but i am new at this.

Subject: FSK on a sine wave

From: Wayne King

Date: 13 Mar, 2011 00:03:04

Message: 4 of 4

"jessica david" wrote in message <ilgvch$hdl$1@fred.mathworks.com>...
> "Wayne King" <wmkingty@gmail.com> wrote in message <ilgqkk$f4n$1@fred.mathworks.com>...
> > "jessica david" wrote in message <ilgook$g9d$1@fred.mathworks.com>...
> > > ok i need to do FSK on a sine wave, but i keep getting an error saying
> > >
> > > " ??? Error using ==> dpskmod at 41
> > > Elements of input X must be integers in the range [0, M-1].
> > >
> > > Error in ==> dpskmodulation at 15
> > > sig = dpskmod(x,M,pi / 8 ) ; "
> > >
> > >
> > > my code is as follows:
> > >
> > >
> > > M = 4; % Use DQPSK in this example, so M is 4.
> > > Fs = 100;
> > > t = [0:2*Fs+1]'/Fs;
> > > Fc = 10; % Carrier frequency
> > > x = sin(2*pi*t); % Sinusoidal signal
> > > figure(1)
> > > plot(t, x);
> > >
> > > sig = dpskmod(x,M,pi / 8 ) ;
> > > figure(2)
> > > plot(y) % Plot all points, using lines to connect them.
> >
> > Hi Jessica, dpskmod() is designed to work on the baseband digital signal, not on the signal modulated by the carrier. You want to input the baseband digital signal. Also, dpskmod is obsolete so you want to use modem.dpskmod.
> >
> > Wayne
>
> what do you mean by "input the baseband digital signal."?
> if I cannpt use dpskmod, how can i digitall modulate a sine wave
> I know it sounds silly but i am new at this.

The baseband signal is the message signal which has support in some neighborhood
[-omega_0, omega_0], then you modulate that message with a carrier frequency usually so that you can transmit it effectively. Just like when a radio station broadcasts a speech signal, the speech signal has a spectrum centered around zero, and then you modulate it with some carrier frequency like 100 MHz to broadcast it.

In this case, we expect your baseband signal to be digital.

Wayne

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us