Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me to find the appropriate code of matlab for QPSK

Status
Not open for further replies.

manik045

Newbie level 6
Joined
Feb 16, 2010
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Dinajpur
Activity points
1,404
Hi i have a problem in my qpsk code in matlab that is given below

plot(abs([Qpsk Qpsk_r])),axis([0 Ns -1 16]),
legend('AWGN','RAYLEIGH'),
title('QPSK in AWGN & Rayleigh fading channel')


It shows the warning below
Warning: Ignoring extra legend entries.
> In legend at 290
In uhguasijfgdfjuf at 39
I could not find the problem where it is in my code.

Here is another problem


d1=find(r1>=0);d2=find(r1<0);
r1(d1)=1;r1(d2)=-1;
d1=find(r2>=0);d2=find(r2<0);
r2(d1)=1;r2(d2)=-1;
if l==1 & k==1,
plot([r1 r2])
legend('AWGN','Rayleigh'),
axis([0 Ns -1 4]),%here Ns=200
title('demodulated symbols after hard decisions')

This is the code for to get the desired received signal after noise removed. The noise is given for AWGN and Rayleigh.
It shows only a horizontal line in plot.


Any kind of help will be appreciated. Thanks
 

do you need a transmitter or receiver code? here is a code following you may use that code or compare your code with this one for any correction/improvement.

for more info visit

https://cnx.org/content/m10627/latest/

check this link also

qpsk matlab code



Code starts from here, visit the site for any query

1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % MATLAB Code for QPSK Digital Transmitter
3
4 % Generate random bits
5 bits_per_symbol=2;
6 num_symbols=128;
7 numbits=bits_per_symbol*num_symbols;
8 bits=rand(1,numbits)>0.5;
9
10 Tsymb = 16; % symbol length
11 omega = pi/2; % carrier frequency
12
13 %%%%%%%%%%%%%%%%%%%%%%%%
14 % Transmitter section
15 % initialize transmit sequence
16 t = zeros(1,num_symbols*Tsymb);
17 i = 1; % initialize bit index
18 n = 1; % initialize time index
19
20 while (n <= num_symbols*Tsymb)
21 if ( bits(i:i+1) == [ 0 0])
22 Igain = 1/sqrt(2);
23 Qgain = 1/sqrt(2);
24 % ------>Insert code here<-------
25
26 end;
27 i = i+2; % next 2 bits
28
29 % Generate symbol to be transmitted
30 t(n:n+Tsymb-1) = %------>Insert code here<-------
31
32 n = n+Tsymb; % next symbol
33 end;
34
35 % Show the transmitted signal and its spectrum
36 % ------>Insert code here<-------
37
38 % Show the transmitted signal constellation
39 rI = t.*cos(omega*[1:num_symbols*Tsymb]);
40 rQ = t.*sin(omega*[1:num_symbols*Tsymb]);
41
42 % Filter out the double-frequency term
43 low_pass=fir1(512,0.5);
44 rI=conv(rI,low_pass);
45 rQ=conv(rQ,low_pass);
46 figure;
47 plot(rI,rQ);
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top