%NRZ-Mclear all;clc;x=[1 0 1 1 0 0 0 1 1 0]; %matriks inputan xn=length(x); %mendapat jumlah isi var xt=0:1/16:n-1/16; %mengatur samplingx(1)=1;xx=x;for k=2:n;if x(k-1)==0 & x(k)==1;xx(k)=-1;endendm=xx;for k=1:n;if xx(k)==0;m(k)=1;endendp=ones(16,1); %matriks 16x1 yg berisi nilai 1a=p*m;d=reshape(a,1,[]);z=d;figure(1)subplot(211)plot (t,d);title('NRZ-M')axis([0 10 -2 2])grid on
subplot(212)s=fft(d,1024);f=0:1024-1;plot(f,20*log10(abs(s)))axis([0 1024 -60 40])grid on
Dan berikut hasil keluarannya :