# Error: Unable to perform assignment because the left and right sides have a different number of elements.

조회 수: 1(최근 30일)
Sara Nasir 10 Aug 2020
댓글: Sara Nasir 10 Aug 2020
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)')

댓글을 달려면 로그인하십시오.

### 답변(1개)

dpb 10 Aug 2020
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.

#### 댓글 수: 1

Sara Nasir 10 Aug 2020
I have to implement this formula

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

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

Start Hunting!

Translated by