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

1 visualizzazione (ultimi 30 giorni)
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)')

Risposte (1)

dpb
dpb il 10 Ago 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.

Community Treasure Hunt

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

Start Hunting!

Translated by