Загрузка данных


clc;
len=2000;
ampl=10;
X=(randi([0;1],len,1)-0.5)*2*ampl;
Y=(randi([0;1],len,1)-0.5)*2*ampl;
Z=complex(X,Y);
table=[1+1j;1-1j;-1+1j;-1-1j];
p=randi([1;4],len,1);
out=table(p)*ampl;
res=resample(out,20,1);
res2=awgn(res,20,'measured');

step=16;win=128;
for i=1:step:len-win
    subplot(2,2,1);
    hold on;
    res3=res2(i:win+i-1);
    plot(res3,'.');
    title('Созвездие');
    hold off;
    
    
    subplot(2,2,2);
    hold on;
    plot(real(res3),'r');
    plot(imag(res3),'b');
    title('Сигнал');
    hold off;
    
    
    subplot(2,2,3);
    hold on;
    SP=10*log10(abs(fftshift(fft(res2))));
    plot(SP)
    a=max(SP);
    plot(a(1),'*r');
    title('Спектр');
    hold off;
    drawnow;
end