我无法根据我的代码绘制两个图表。
代码如下:
clear all;
close all;
clc;
% number of bits
L = 1e4;
N = 1;
M = L/N;
u = [ ones(1,N) ];
alpha = 0.3;
% LED information
Vt = 0.5;
Is = 0.12;
% LED model
K = 0.8;
imax = 0.5;
threshold = 150;
sigmaV2 = (imax/threshold)^2;
% Signal to Noise Ratio (in dB)
SNRdB = -10:2:32;
SNR = 10.^(SNRdB/10);
% standard deviation of the signal (power)
sigmaX2v = SNR*sigmaV2;
alphaICS = 0.3;
% Minimum number of bits for BER calculation
minNbits = 500;
for count=1:length(SNRdB)
an = 2*randi([ 0 1 ],1,L)-1;
bn = 2*randi([ 0 1 ],1,L)-1;
dI = 2*randi([ 0 1 ],1,L)-1;
dQ = 2*randi([ 0 1 ],1,L)-1;
sn = an.*(sqrt(1-alpha) + sqrt(alpha).*dI) +1i.*bn.*(sqrt(1-alpha) + sqrt(alpha).*dQ);
sn1 = sn.';
Y = sn1; % transmitter
stdS = std(Y);
X = zeros(1,4*L);
X(2:2:end) = [Y; conj(Y(end:-1:1))];
xTD = ifft(X);
xTD = (sqrt(sigmaX2v(count)))*xTD/std(xTD);
xx = xTD;
ind = find(xTD < 0);
xx(ind) = zeros(size(ind));
ss = xx;
iLED = Is*(exp(ss/Vt)-1);
xLED = iLED./( (1 + (iLED/imax).^(2*K)).^(1/(2*K)));
nErrorsBitsInf = 0;
nErrorsBitsW = 0;
cont = 0;
while ( (nErrorsBitsW < minNbits) || (nErrorsBitsInf < minNbits))
cont = cont + 1;
v = sqrt(sigmaV2)*randn(size(xx));
y = xLED + v;
Nframe = length(y);
Xhat = (fft(y));
Shat = Xhat(2:2:Nframe/2);
Shat = stdS*Shat/std(Shat); % receiver
end
end
我想绘制两个单独的图形:一个是接收器的结果 (Shat),另一个是发射器的结果 (Y)。
如何绘制如下示例图所示的数据(标题中的位并用标记分隔)?