dpsk .wav file in matlab

Status
Not open for further replies.

jess17

Junior Member level 3
Joined
Mar 4, 2011
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,431
ok, i need to modulate this .wav file in matlab. I tried the command

%to read .wav
[y,fs,n]=wavread('wavefile');
t = (1:n) / fs;
sound; %plays the sound and plots it.
figure(1)
plot

%carrier signal.
% frequency
fc = fs/3;
c = cos(2 * pi * fc * t);
figure(2)
plot(t,c);

to modulate,
M=4;
sig =dpskmod(x,M)

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

what should the value of M be?
 

where is x?
 

to modulate,
M=4;
sig =dpskmod(x,M)

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

what should the value of M be?

First of all you did not specify x. It should be quantized value of the signal y. You must first quantize y with n bits resolution and then form symbols with values 0,1,2 or 3 using consecutive 2 bits of quantized signal (for M=4) . Store the resulting symbols in x and then execute
Code:
sig =dpskmod(x,M)
 

i tried with

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

but keep getting the same error. Is quantising like converting it to digital form?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…