Error: Unable to perform assignment because the left and right sides have a different number of elements.
조회 수: 1 (최근 30일)
이전 댓글 표시
M = 64; %Number of subcarriers
K = 4; %Overlapping factor
y = [-0.23514695 -sqrt(2)/2 -0.97195983 1 0.97195983 sqrt(2)/2 0.23514695];
T = M;
l = K*T;
a = K*M;
t = -a/2:a/(2-1);
h = zeros(1,10000);
size(h);
for k = -3:3
for x=0:6
r = k+3;
abc=size((y(x+1)^2)*cos((2*k*pi*t)/l));
h(r+1)= (y(x+1)^2)*cos((2*k*pi*t)/l); Error here
end
end
h = [h{:}];
h = h(1)+h(2)+h(3)+h(4)+h(5)+h(6)+h(7);
a = 1+ (2*h);
figure(1)
plot (a)
xlabel('t')
ylabel('h(t)')
댓글 수: 0
답변 (1개)
dpb
2020년 8월 10일
h(r+1)= (y(x+1)^2)*cos((2*k*pi*t)/l); Error here
Above, t was defined as
t = -a/2:a/(2-1);
and a = K*M ==> 4. 64 ==> 256
Hence
t=[-128:256];
which will have 384+1 = 385 elements. The index r+1 on the LHS is just one element in length.
Dunno what you want or intended, but that's the mismatch.
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!