please check the following code in shown the error

1 次查看(过去 30 天)
clc;
clear all;
close all;
K=5;
M=100:100:1000;
q=10;
s = 0 + q.*randn(K,1);
v = s/10;
si=10.^v;
d=randi([10 50],K,1);
u=1;
a=2.0;
z=(d.^a);
%flat fading channel matrix
for k=1:K
b(k)=(1*si(k))/z(k);
end
D=diag(sqrt(b));
for t=1:10
H(t) = rand(M(t),K) + i*rand(M(t),K);
end
for y=1:10
G(y)=H(y) * D
end

回答(1 个)

Roger Stafford
Roger Stafford 2018-3-9
It looks to me as though the line
H(t) = rand(M(t),K) + i*rand(M(t),K);
is in error. On the first trip through that for-loop, you are trying to stuff a 100 x 5 matrix into what appears to be a scalar location in vector H. How do you expect it to fit? Better think that step over again more carefully.

Community Treasure Hunt

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

Start Hunting!

Translated by