Code covered by the BSD License  

Highlights from
phase shift keying function

image thumbnail

phase shift keying function

by

 

03 Nov 2010 (Updated )

functions here return you the envelope of the signal there is option for frequency and power input

psk_demod( psk_signal,frequency )
function [ bit_op ] = psk_demod( psk_signal,frequency )
% psk_demod demodulates the psk signal
%   Detailed explanation goes here
% frequency=fre;
% psk_signal=channel_multi;
bit_count1=0;
bit_count0=0;
nbit=0;
samples=1000;
l=length(psk_signal);
nobits=l/samples;
b=ones(1,nobits);
carrier_signal=psk_op(b,frequency,10);

demod_sig1=psk_signal.*carrier_signal;
demod_sig=row_to_column(demod_sig1,samples);


for i=1:nobits
    bit_count1=0;
bit_count0=0;
    for j=1:samples
        if (demod_sig(i,j)>0.00000000000000000001)
            bit_count1=bit_count1+1;
            
        else if (demod_sig(1,j)<-0.00000000000000000001)
            bit_count0=bit_count0+1;
        end
        end
    end
    
    if (bit_count1>bit_count0)
        nbit(1,i)=1;
    else
        nbit(1,i)=0;
    end

end
bit_op=nbit;    

end

Contact us