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.

Output error in a BPSK code in Matlab

Status
Not open for further replies.

gkr

Newbie level 2
Joined
Jun 2, 2009
Messages
2
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,283
Location
pune
Activity points
1,299
this is the bpsk code i tried in matlab.. but no output... plz help...

for j=1:7
eb1(j)=j;
no=1;
eb2(j)=10.^(eb1(j)/10);
a=sqrt(eb2(j)/4);
%s=[];
s1=[a a a a];
s2=[-a -a -a -a];
psi=[0.5 0.5 0.5 0.5];
x=0;


for i=1:10000
d=randint(i);
if d==1
s=s1;
else
s=s2;
end


n=randn(1,4);
n1=n*sqrt(no/2);


r=s+n1;
z=r.*psi;
z1=sum(z);


if(z1>0)
z=1;
else
z=0;
end

if z==d
x;
else
x=x+1;
end
end

pb(j)=x/10000;
pb(1)=qfunc(sqrt(2*eb2/no));
end
figure
semilogy(eb1,pb,'-b',eb1,pb,'--');
grid on;
title('probability error in BPSK');
xlabel('SNR in dB');
ylabel('probability error');
legend('MATLAB simulated error','ideal error');
 

Re: bpsk code in matlab

no mistakes... i mean no errors in matlab....
the program is just running without an end...
is there any mistake in the code or what??
 

Re: bpsk code in matlab

go step by step and see if your variable are loaded with the appropriate values
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top