How to resolve this error: Unable to perform assignment because the size of the left side is 1000-by-1 and the size of the right side is 1000-by-1000
Howe to resolve this error:
Unable to perform assignment because the size of the left side is 1000-by-1 and the size of the right
side is 1000-by-1000.
Error in servssnr (line 43)
ynoisy(:,ii) = awgn(real(y),snr(ii),’measured’); % Add AWGN
This is my full code:
PRF = 500e3; % Pulse Repetition Frequency (Hz)
sampling_freq = 60e6; % Sampling Frequency (Hz)
carrier_freq = 2.4e9;
rng(‘default’) % Set random number seed for repeatability
M = 4;
EbNo = 0:13;
[ber,ser] = berawgn(EbNo,’pam’,M);
n = 1000; % Number of symbols to process
k = log2(M); % Number of bits per symbol
snr = EbNo+3+10*log10(k); % In dB
ynoisy = zeros(n,length(snr));
z = zeros(n,length(snr));
errVec = zeros(3,length(EbNo));
grid on;
errcalc = comm.ErrorRate;
%x1 = randi([0 M-1],n,1); % Create message signal
% Generate Gold code
code1 = comm.GoldSequence(‘FirstPolynomial’,’x^6+x^5+1′, ‘FirstInitialConditions’,[ 0 0 0 0 0 1], ‘SecondPolynomial’,’x^6+x^5+x^4+x+1′, ‘SecondInitialConditions’,[0 0 0 0 0 1], ‘Index’,1, ‘SamplesPerFrame’,1000);
gold_code = code1();
% Generate Kasami code
kasamiseq = comm.KasamiSequence(‘Polynomial’,[6 5 4 1 0], ‘InitialConditions’,[ 0 0 0 0 0 1],’SamplesPerFrame’,1000);
kasami_code = kasamiseq()
y1 = pammod(gold_code,M); % Modulate
for ii = 1:length(snr)
reset(errcalc)
ynoisy(:,ii) = awgn(real(y1),snr(ii),’measured’); % Add AWGN
z(:,ii) = pamdemod(complex(ynoisy(:,ii)),M); % Demodulate
errVec(:,ii) = errcalc(gold_code,z(:,ii)); % Compute SER from simulation
end
semilogy(EbNo,errVec(1,:),’r’);
hold on;
% Modulate kasami code with barker code
x5 = cos(2*pi*carrier_freq*(0:numel(gold_code)-1)/sampling_freq) .* (gold_code .* kasami_code.’);
y = pammod(x5,M); % Modulate
for ii = 1:length(snr)
reset(errcalc)
ynoisy(:,ii) = awgn(real(y),snr(ii),’measured’); % Add AWGN
z(:,ii) = pamdemod(complex(ynoisy(:,ii)),M); % Demodulate
errVec(:,ii) = errcalc(x5,z(:,ii)); % Compute SER from simulation
end
semilogy(EbNo,errVec(1,:),’b’);
hold on;
y2 = pammod(kasami_code,M);
for ii = 1:length(snr)
reset(errcalc)
ynoisy(:,ii) = awgn(real(y2),snr(ii),’measured’); % Add AWGN
z(:,ii) = pamdemod(complex(ynoisy(:,ii)),M); % Demodulate
errVec(:,ii) = errcalc(kasami_code,z(:,ii)); % Compute SER from simulation
end
semilogy(EbNo,errVec(1,:),’g’);
legend(‘Gold code’,’Gold-Kasami’, ‘Kasami’);
title(‘Comparison of SER ‘);
xlabel(‘E_b/N_0 (dB)’);
ylabel(‘Symbol Error Rate’);
grid on;
hold off;Howe to resolve this error:
Unable to perform assignment because the size of the left side is 1000-by-1 and the size of the right
side is 1000-by-1000.
Error in servssnr (line 43)
ynoisy(:,ii) = awgn(real(y),snr(ii),’measured’); % Add AWGN
This is my full code:
PRF = 500e3; % Pulse Repetition Frequency (Hz)
sampling_freq = 60e6; % Sampling Frequency (Hz)
carrier_freq = 2.4e9;
rng(‘default’) % Set random number seed for repeatability
M = 4;
EbNo = 0:13;
[ber,ser] = berawgn(EbNo,’pam’,M);
n = 1000; % Number of symbols to process
k = log2(M); % Number of bits per symbol
snr = EbNo+3+10*log10(k); % In dB
ynoisy = zeros(n,length(snr));
z = zeros(n,length(snr));
errVec = zeros(3,length(EbNo));
grid on;
errcalc = comm.ErrorRate;
%x1 = randi([0 M-1],n,1); % Create message signal
% Generate Gold code
code1 = comm.GoldSequence(‘FirstPolynomial’,’x^6+x^5+1′, ‘FirstInitialConditions’,[ 0 0 0 0 0 1], ‘SecondPolynomial’,’x^6+x^5+x^4+x+1′, ‘SecondInitialConditions’,[0 0 0 0 0 1], ‘Index’,1, ‘SamplesPerFrame’,1000);
gold_code = code1();
% Generate Kasami code
kasamiseq = comm.KasamiSequence(‘Polynomial’,[6 5 4 1 0], ‘InitialConditions’,[ 0 0 0 0 0 1],’SamplesPerFrame’,1000);
kasami_code = kasamiseq()
y1 = pammod(gold_code,M); % Modulate
for ii = 1:length(snr)
reset(errcalc)
ynoisy(:,ii) = awgn(real(y1),snr(ii),’measured’); % Add AWGN
z(:,ii) = pamdemod(complex(ynoisy(:,ii)),M); % Demodulate
errVec(:,ii) = errcalc(gold_code,z(:,ii)); % Compute SER from simulation
end
semilogy(EbNo,errVec(1,:),’r’);
hold on;
% Modulate kasami code with barker code
x5 = cos(2*pi*carrier_freq*(0:numel(gold_code)-1)/sampling_freq) .* (gold_code .* kasami_code.’);
y = pammod(x5,M); % Modulate
for ii = 1:length(snr)
reset(errcalc)
ynoisy(:,ii) = awgn(real(y),snr(ii),’measured’); % Add AWGN
z(:,ii) = pamdemod(complex(ynoisy(:,ii)),M); % Demodulate
errVec(:,ii) = errcalc(x5,z(:,ii)); % Compute SER from simulation
end
semilogy(EbNo,errVec(1,:),’b’);
hold on;
y2 = pammod(kasami_code,M);
for ii = 1:length(snr)
reset(errcalc)
ynoisy(:,ii) = awgn(real(y2),snr(ii),’measured’); % Add AWGN
z(:,ii) = pamdemod(complex(ynoisy(:,ii)),M); % Demodulate
errVec(:,ii) = errcalc(kasami_code,z(:,ii)); % Compute SER from simulation
end
semilogy(EbNo,errVec(1,:),’g’);
legend(‘Gold code’,’Gold-Kasami’, ‘Kasami’);
title(‘Comparison of SER ‘);
xlabel(‘E_b/N_0 (dB)’);
ylabel(‘Symbol Error Rate’);
grid on;
hold off; Howe to resolve this error:
Unable to perform assignment because the size of the left side is 1000-by-1 and the size of the right
side is 1000-by-1000.
Error in servssnr (line 43)
ynoisy(:,ii) = awgn(real(y),snr(ii),’measured’); % Add AWGN
This is my full code:
PRF = 500e3; % Pulse Repetition Frequency (Hz)
sampling_freq = 60e6; % Sampling Frequency (Hz)
carrier_freq = 2.4e9;
rng(‘default’) % Set random number seed for repeatability
M = 4;
EbNo = 0:13;
[ber,ser] = berawgn(EbNo,’pam’,M);
n = 1000; % Number of symbols to process
k = log2(M); % Number of bits per symbol
snr = EbNo+3+10*log10(k); % In dB
ynoisy = zeros(n,length(snr));
z = zeros(n,length(snr));
errVec = zeros(3,length(EbNo));
grid on;
errcalc = comm.ErrorRate;
%x1 = randi([0 M-1],n,1); % Create message signal
% Generate Gold code
code1 = comm.GoldSequence(‘FirstPolynomial’,’x^6+x^5+1′, ‘FirstInitialConditions’,[ 0 0 0 0 0 1], ‘SecondPolynomial’,’x^6+x^5+x^4+x+1′, ‘SecondInitialConditions’,[0 0 0 0 0 1], ‘Index’,1, ‘SamplesPerFrame’,1000);
gold_code = code1();
% Generate Kasami code
kasamiseq = comm.KasamiSequence(‘Polynomial’,[6 5 4 1 0], ‘InitialConditions’,[ 0 0 0 0 0 1],’SamplesPerFrame’,1000);
kasami_code = kasamiseq()
y1 = pammod(gold_code,M); % Modulate
for ii = 1:length(snr)
reset(errcalc)
ynoisy(:,ii) = awgn(real(y1),snr(ii),’measured’); % Add AWGN
z(:,ii) = pamdemod(complex(ynoisy(:,ii)),M); % Demodulate
errVec(:,ii) = errcalc(gold_code,z(:,ii)); % Compute SER from simulation
end
semilogy(EbNo,errVec(1,:),’r’);
hold on;
% Modulate kasami code with barker code
x5 = cos(2*pi*carrier_freq*(0:numel(gold_code)-1)/sampling_freq) .* (gold_code .* kasami_code.’);
y = pammod(x5,M); % Modulate
for ii = 1:length(snr)
reset(errcalc)
ynoisy(:,ii) = awgn(real(y),snr(ii),’measured’); % Add AWGN
z(:,ii) = pamdemod(complex(ynoisy(:,ii)),M); % Demodulate
errVec(:,ii) = errcalc(x5,z(:,ii)); % Compute SER from simulation
end
semilogy(EbNo,errVec(1,:),’b’);
hold on;
y2 = pammod(kasami_code,M);
for ii = 1:length(snr)
reset(errcalc)
ynoisy(:,ii) = awgn(real(y2),snr(ii),’measured’); % Add AWGN
z(:,ii) = pamdemod(complex(ynoisy(:,ii)),M); % Demodulate
errVec(:,ii) = errcalc(kasami_code,z(:,ii)); % Compute SER from simulation
end
semilogy(EbNo,errVec(1,:),’g’);
legend(‘Gold code’,’Gold-Kasami’, ‘Kasami’);
title(‘Comparison of SER ‘);
xlabel(‘E_b/N_0 (dB)’);
ylabel(‘Symbol Error Rate’);
grid on;
hold off; matlab, digital signal processing, radar, error, dimensions, binary MATLAB Answers — New Questions