# i am facing problem in Bpsk Moudlation!!!!!

pakistan
edited April 2015 in Matlab

I have written a code that modulate three bytes of data the modulation is Bpsk.But the issue is fft shows that the carrier which i generate having peak at my desired frequency while the fft of modulated signal have peaks at center freuency along with near by freuency is it ok??? Second thing is which confused me more that algorithem which i follows does;nt ensure that message data bits have any frequency kindly help me in this regard.i have attached my code along with fft of carrier signal and modulated signal.

clc
msg_orig(1)=0;
msg_orig(2)=1;
msg_orig(3)=0;
msg_orig(4)=0;
msg_orig(5)=1;
msg_orig(6)=0;
msg_orig(7)=1;
msg_orig(8)=1;
msg_orig(9)=0;
msg_orig(10)=0;
msg_orig(11)=0;
msg_orig(12)=1;
msg_orig(13)=0;
msg_orig(14)=0;
msg_orig(15)=1;
msg_orig(16)=0;
msg_orig(17)=1;
msg_orig(18)=1;
msg_orig(19)=0;
msg_orig(20)=0;
msg_orig(21)=0;
msg_orig(22)=1;
msg_orig(23)=0;
msg_orig(24)=0;

msg_NRZ=zeros(1,1152);
sig_I=zeros(1,1152);

t=[1:1:1152];
k=1;

t_1 = [ 0 : 1 :1152 ]; % Time Samples
f = 8000; % Input Signal Frequency
fs = 96000; % Sampling Frequency
c_carrier = round(10000sin(2pif/fst_1)); % Generate Sine Wave

for j=1:24
if msg_orig(j)==1
for m=1:48
msg_NRZ(k)=1;
k=k+1;
end
end
if msg_orig(j)==0
for l=1:48
msg_NRZ(k)=-1;
k=k+1;
end
end
end

`````` for i=1:1152

sig_I(i) = msg_NRZ(i) * c_carrier(i);

end
``````

% figure(1);
% stem(t,sig_I,'r'); % View the samples
% figure(2);
% stem(t1/fs1000,sig_I,'r'); % View the samples
% hold on;
plot(t1/fs1000,sig_I); % Plot Sine Wave

Fs=96000;
T = 1/Fs; % Sample time
L = 8000; % Length of signal
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(sig_I,NFFT)/L;
f = 96/2*linspace(0,1,NFFT/2+1);

% Plot single-sided amplitude spectrum.
plot(f1000,2abs(Y(1:NFFT/2+1)))
title('Single-Sided Amplitude Spectrum of BPSK signal')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')

Sign In or Register to comment.

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!