please check the following code in shown the error

조회 수: 1 (최근 30일)
VISHALI V
VISHALI V 2018년 3월 9일
답변: Roger Stafford 2018년 3월 9일
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