A list,

14 Principle of ASK signal







24 Principle of ASK modulation and demodulation







Ii. Source code

M=4; d=1; T = 0-0. 001:0.999; A = randint (1,20,2); i=1000; for n=0:9 sym(n+1)=a(2*n+1)*2+a(2*n+2); End s = sym (ceil (10 * t + 0.01)). * cos (2 * PI * 100 * t); Subplot (4,1,1); The plot (t, a (ceil ((0.1) 100 * t + / 5))); Title (' binary signal '); The axis ([0, 1, 0.2, 1.2]). Subplot (4,1,2); The plot (t, sym (ceil (10 * t + 0.01))); Title (' quad signal '); Subplot (4,1,3); Plot (t,s) title('4ASK signal '); % coherent demodulation at=s.*cos(2* PI *100*t); at=at-mean(at); [f,af]= T2F(t,at); % pass low pass filter [t,at]= LPF (f, AF,80); % for m=0:9; If the at (1, m + 50 * 100) > 0.5; for j=m*100+1:(m+1)*100; at(1,j)=3; end else if at(1,m*100+50)>0; for j=m*100+1:(m+1)*100; at(1,j)=1; The end % script file f2t. m defines the function F2T to compute the inverse Fourier transform of the signal. function [t,st]=F2T(f,sf) %This function calculate the time signal using ifft function for the input %signal's spectrum df = f(2)-f(1); Fmx = ( f(end)-f(1) +df); dt = 1/Fmx; N = length(sf); T = dt*N; %t=-T/2:dt:T/2-dt; t = 0:dt:T-dt; sff = fftshift(sf); st = Fmx*ifft(sff); function [t,st]=lpf(f,sf,B) %This function filter an input data using a lowpass filter %Inputs: f: frequency samples % sf: input data spectrum samples % B: lowpass's bandwidth with a rectangle lowpass %Outputs: t: time samples % st: output data's time samples df = f(2)-f(1); T = 1/df; hf = zeros(1,length(f)); % all zero matrix bf = [-floor(B/df): floor(B/df)] + floor(length(f)/2); hf(bf)=1; yf=hf.*sf; [t,st]=F2T(f,yf); st = real(st);Copy the code

3. Operation results

The code downloadwww.cnblogs.com/ttmatlab/p/…