# problem in 8psk demodulation-decision region

Started by March 10, 2003
 Hi everyone, I am trying to simulate 8PSK modulation-demodulation scheme in matlab. The problem arises in the decision making after matched filtering and re-sampling. I am comparing the angles of received signal and taking decision accordingly as shown in the code below. But seems that it misses out few symbols or is not working properly. Any idea???? what would be the optimum decision????????? Thanks, kunal. ( Here, ym is the Received signal after Matched filtering and Re-sampling. and s1=[1 1 1]; s2=[0 1 1]; s3=[0 1 0]; s4=[0 0 0]; s5=[0 0 1]; s6=[1 0 1]; s7=[1 0 0]; s8=[1 1 0]; ) k2=1; for i=1:length(ym) ang1=angle(ym(i)); if(ang1>15*pi/8 & ang1<=pi/8) Rx(1,k2:k2+2)=s1; elseif(ang1>pi/8 & ang1<=3*pi/8) Rx(1,k2:k2+2)=s2; elseif(ang1>3*pi/8 & ang1<=5*pi/8) Rx(1,k2:k2+2)=s3; elseif(ang1>5*pi/8 & ang1<=7*pi/8) Rx(1,k2:k2+2)=s4; elseif(ang1>7*pi/8 & ang1<=9*pi/8) Rx(1,k2:k2+2)=s5; elseif(ang1>9*pi/8 & ang1<*pi/8) Rx(1,k2:k2+2)=s6; elseif(ang1>11*pi/8 & ang1<*pi/8) Rx(1,k2:k2+2)=s7; elseif(ang1>13*pi/8 & ang1<*pi/8) Rx(1,k2:k2+2)=s8; else end; k2=k2+3; end; after this I am comparing Rx with the original data using biterr.
 Hi... There's a little mistake near the beginning of yout code (I didn't check the rest of it, but it's probably the only mistake). If you examine carefully your first if statement, if(ang1>15*pi/8 & ang1<=pi/8) you'll see the condition you've specified is impossible to satisfy, as angl can never be greater than 15*pi/8 the same time as being less than pi/8. (You mentally wrapped the angle around 2*pi over to zero, but obviously for MATLAB, angl is just another variable). Here's the code to get it working: s1=[1 1 1]; s2=[0 1 1]; s3=[0 1 0]; s4=[0 0 0]; s5=[0 0 1]; s6=[1 0 1]; s7=[1 0 0]; s8=[1 1 0]; s9=[1 1 1]; % I've used s9 = s1 to circumvent the wrap-around problem. s = [s1; s2; s3; s4; s5; s6; s7; s8]; n = pi/8:2*pi/8:17*pi/8; % I'm avoiding the lengthy if-else ladder. This array will hold % threshold angles you used. The last value of 17*pi/8 is again to % get around the wrap around problem Rx = zeros(length(ym), 3); % Initialise the output array for k = 1:length(ym) angl = angle(ym(k)); ii = min(find(angl<=n)); Rx(k,:) = s(ii,:); % The above two statements are sufficient to replace the if-else ladder % in your code. Always look to vectorise your code. Also I feel that the % the use of i (or j) as variables should be avoided in programs with % complex number operations such as yours, so that you don't % inadvertantly replace sqrt(-1) with some other value. end Rx = Rx'; Rx = Rx(:)'; % These two lines bring the output code into desired format Please check the above code to make sure it works properly. Regards AK On Tue, 11 Mar 2003 raval kunal wrote : >Hi everyone, >I am trying to simulate 8PSK modulation-demodulation scheme in >matlab. The problem arises in the decision making after matched >filtering and re-sampling. >I am comparing the angles of received signal and taking decision >accordingly as shown in the code below. But seems that it misses >out few symbols or is not working properly. Any idea???? what >would be the optimum decision????????? >Thanks, >kunal. >( Here, ym is the Received signal after Matched filtering and >Re-sampling. and > s1=[1 1 1]; s2=[0 1 1]; s3=[0 1 0]; s4=[0 0 0]; > s5=[0 0 1]; s6=[1 0 1]; s7=[1 0 0]; s8=[1 1 0]; ) >k2=1; > for i=1:length(ym) > ang1=angle(ym(i)); > > if(ang1>15*pi/8 & ang1<=pi/8) > Rx(1,k2:k2+2)=s1; > elseif(ang1>pi/8 & ang1<=3*pi/8) > Rx(1,k2:k2+2)=s2; > elseif(ang1>3*pi/8 & ang1<=5*pi/8) > Rx(1,k2:k2+2)=s3; > elseif(ang1>5*pi/8 & ang1<=7*pi/8) > Rx(1,k2:k2+2)=s4; > elseif(ang1>7*pi/8 & ang1<=9*pi/8) > Rx(1,k2:k2+2)=s5; > elseif(ang1>9*pi/8 & ang1<*pi/8) > Rx(1,k2:k2+2)=s6; > elseif(ang1>11*pi/8 & ang1<*pi/8) > Rx(1,k2:k2+2)=s7; > elseif(ang1>13*pi/8 & ang1<*pi/8) > Rx(1,k2:k2+2)=s8; > else > > end; > k2=k2+3; > end; >after this I am comparing Rx with the original data using >biterr. > >_____________________________________ >Note: If you do a simple "reply" with your email client, only the >author of this message will receive your answer. You need to do >a "reply all" if you want your answer to be distributed to the >entire group. >_____________________________________ >About this discussion group: >To Join: >To Post: >To Leave: >Archives: >http://www.yahoogroups.com/group/matlab >More DSP-Related Groups: >http://www.dsprelated.com/groups.php3 >br /> >. __________________________________________________________ Great Travel Deals, Airfares, Hotels on http://www.journeymart.com/rediff/travel.asp