📄 qammod_100.m
字号:
clc
close all
clear
M = 16;
k = log2(M); % Modulation order
EbNo = 14; % Eb/No in dBs
%x = [0:M-1];
%x = uint8(rand(100)*100);
% x = randint(32,1,[0 M-1])
%x = [3 6 9 2 14 12 8 10] % 5 8 1 4 7 36 99 88 24 25 23 26]
x = [15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2];
figure(1); grid on;
%plot(x);
figure(1); stem(x);ylabel(['x rand data M = ',num2str(M)]);
% subplot(5,1,1); plot(real(x)); ylabel('x');
y = qammod(x,M)
figure(2);
% See how scaling affects constellation.
% h = scatterplot(y,1,0,'ro'); % Unscaled constellation
h = scatterplot(y); grid on;
hold on; % Next plot will be in same figure window.
% scatterplot(y*scale,1,0,'bx',h); % Scaled constellation
% hold off;
% Create the Eye Diagram.
% h1 = eyediagram(y, N);
% scatterplot(y);
% Transmit signal through an AWGN channel.
% ynoisy = awgn(y,EbNo+10*log10(k),'measured');
% Display constellation of received signal.
% scatterplot(ynoisy);
figure(3);
% subplot(2,1,1); plot(real(y));ylabel('y real');
% subplot(2,1,2); plot(imag(y));ylabel('y imag');
subplot(2,1,1); stem(real(y));ylabel('y real'); grid on;
subplot(2,1,2); stem(imag(y));ylabel('y imag'); grid on;
%scale = modnorm(y,'peakpow',1);
%y = scale*y; % Scale the constellation.
%subplot(4,1,2); modmap('qask',M);
%scatterplot(y); % Plot the scaled constellation.
% Include text annotations that number the points.
% hold on; % Make sure the annotations go in the same figure.
% for jj=1:length(y)
% text(real(y(jj)),imag(y(jj)),[' ' num2str(jj-1)]);
% end
% f = ifft(y)
%f = ifft(y)
%scatterplot(f);
% figure(3);
% subplot(2,1,1); plot(real(f));ylabel('f real');
% subplot(2,1,2); plot(imag(f));ylabel('f imag');
% clf reset;
% df = fft(real(f));
% plot(df);
% hold off;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -