unable to match the vector length for left and right side for the e(k) value

1 Ansicht (letzte 30 Tage)
clc;
clear all;
close all;
M=3000; % number of data samples
T=2000; %number of training symbols
dB=25 %SNR in dB value
dB = 25
L=30; %length for smoothing
ChL=5; %length of the channel(ChL+1)
EqD=round((L+ChL)/2); %Delay for equalization
Ch=randn(1,ChL+1)+sqrt(-1)*randn(1,ChL+1); %complex channel
Ch=Ch/norm(Ch); %scale the channel with norm
TxS=round(rand(1,M))*2-1; %QPSK transmitted sequence
TxS=TxS+sqrt(-1)*(round(rand(1,M))*2-1);
x=filter(Ch,1,TxS); %channel distortion
n=randn(1,M); %+sqrt(-1)*randn(1,M); %Additive white gaussian noise
n=n/norm(n)*10^(-dB/20)*norm(x);%scale the noise power in accordance with SNR
x=x+n; %received noisy signal
K=M-L; %Discarding several starting samples for avoiding 0's and negative
X=zeros(L+1,K); %each vector column is a sample
for i=1:K
X(:,i)=x(i+L:-1:i).';
end
%Adaptive RLS Equalizer
e=zeros(1,T-10); %initial error
c=zeros(1,L+1); % initial condition
%Initialization of Rinverse
R_inverse=100*eye(L+1);
for k=1:1:T-10
% y=X(:,k+10)';
% disp(y)
e(k)=TxS(k+10+L-EqD)-c*X(:,k+10)*X(:,k+10)';
%finding error
%RLS Parameters
filtered_infrmn_vect=R_inverse*X(:,k+10);
norm_error_power=X(:,k+10)'*filtered_infrmn_vect;
gain_constant=1/(1+norm_error_power);
norm_filtered_infrmn_vect=gain_constant*filtered_infrmn_vect;
%updating weight values of equalizer
% Weight update using RLS algorithm
c=c+ (e(k)*norm_filtered_infrmn_vect);
%updating R inverse
R_inverse=R_inverse-norm_filtered_infrmn_vect'*norm_filtered_infrmn_vect;
end
Unable to perform assignment because the left and right sides have a different number of elements.
sb= c*X;
%SER(decision part)
sb1=sb/norm(c);
sb1=sign(real(sb1))+sqrt(-1)*sign(imag(ab1));%symbol detection
start=12;
sb2=sb1-TxS(start+1:start+length(sb1)); %error detection
SER=length(find(sb2~=0))/length(sb2); % SER calculation
disp(SER);
%plot of transmitted symbols
subplot(2,2,1),
plot(TxS,'*');
grid,title('Input symbols'); xlabel('real part'),ylabel('imaginary part')
axis([-2 2 -2 2])
%plot of received symbols
subplot(2,2,2),
plot(x,'o');
grid,title('Received symbols'), xlabel('real part'), ylabel('imaginary part')
%plot of the equalized symbols
subplot(2,2,3),
plot(sb,'o');
grid,title('Equalized symbols'), xlabel('real part'), ylabel('imaginary part')
%convergence
subplot(2,2,4),
plot(abs(e));
grid, title('Convergence'), xlabel('n'), ylabel('error signal')

Akzeptierte Antwort

Chandra
Chandra am 25 Mai 2022
Hi,
In this code, tr using a cell when assigning an array and extract the values individually when plotting
So here are some changes that needed for the code to get executed
change at line 25
e=cell(1,(T-10)); %initial error
change at line 32
e(k)={TxS(k+10+L-EqD)-c*X(:,k+10)*X(:,k+10)'};
change at line 41
c=c+ (cell2mat(e(k))*norm_filtered_infrmn_vect);
change at line 49 (here ab1 is used instead of sb1 Check before correcting)
sb1=sign(real(sb1))+sqrt(-1)*sign(imag(sb1));%symbol detection
change the last plot depending on your requirement
for i = 1:T-10
plot(abs(e{i}));
hold on;
end
Please refer to the the attachment for the complete program in a txt document
Refer to the "cell2mat " documentation for extracting the values from cell in the above program.

Weitere Antworten (1)

Satyajit Rajbanshi
Satyajit Rajbanshi am 26 Mai 2022
@Chandra Thank you so much for your kind help sir..it's working but i'm not getting any plot for figure 3.
  1 Kommentar
Chandra
Chandra am 26 Mai 2022
Hi,
change the line 41 to the following code line and give the value of "a" less than 1 like 0.1,0.001,...(prefer a =, 0.01)
c=c+ a*(cell2mat(e(k))*norm_filtered_infrmn_vect);
change the plot 3 i.e., on line 65 to ( remove abs as we are plotting real and imaginary )
plot((sb),'o');

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Propagation and Channel Models finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by