How can i correct ??? Error using ==> plus Matrix dimensions must agree.

2 views (last 30 days)
This is my program for channel estimation its showing the error ??? Error using ==> plus Matrix dimensions must agree. Can any one help me to correct this error
Error in ==> formula at 134
A =(((beta'*beta))+((0.9997).*(eye(40)))); %noise variance is assumed = 1
%%%%%program
%%Path coefficient estimation
for k = 1:40
lem=zeros(0,3779);
for n = 0:3779
lem(k,n+1)= 1-(exp(-2j*pi*(n/3780))+exp(2j*pi*(n/3780))); %lemda_i
end
end
thetha=zeros(1,3779);
for n = 0:3779
thetha(n+1,1) = 1;
thetha(n+1,2) = n; %thetha_n
end
beta = lem*thetha; %beta_i
y_p = cen_plts;
A =(((beta'*beta))+((0.9997).*(eye(40)))); %noise variance is assumed = 1
% A=((transpose(beta))*beta);
B = inv(A);
C = (beta') * (y_p.');
rho_cap = B/C;
h_inl = thetha * rho_cap;
g_i = sum(h_inl)/3780;
G_i = g_i * eye(3780);
x_ik=zeros(1,3780);
plot(x_ik);
figure;
%channel equalization: which is ONE-TAP-EQUALIZATION for AWGN channel
x_ik(:,sym) = r_data.* ( conj(g_i) / ((abs(g_i)^2) + 0.9997) );
  1 Comment
Matt J
Matt J on 22 Apr 2013
Edited: Matt J on 22 Apr 2013
Incidentally, your profile shows you have a habit of not "Accept-clicking" the answers that people give you. This is going to make contributors here disinclined to help you.
Also, many of your questions deal with simple dimension mismatch and indexing errors that you could easily catch using the DBSTOP command or other MATLAB debugger tools. Contributors are going to want to see you develop your own debugging skills for such simple errors.

Sign in to comment.

Answers (1)

Matt J
Matt J on 22 Apr 2013
Edited: Matt J on 22 Apr 2013
Perhaps you meant to have
A =(((beta*beta'))+((0.9997).*(eye(40))));
In any case, beta'*beta will be 3780x3780, so you cannot add it to a 40x40 identity matrix.

Community Treasure Hunt

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

Start Hunting!