I keep getting the error message that vectors must be the same length in the plot command

fc = (f1 + f2)/2;
r = 2e10;
Bw = 2e8;
Tp = 5e-7;
t2 = 0:r*21:20;
t3=-10:r*10+1:10;
t4= 0:r*31:30;
W = Bw;
w = hamming(t2);
h = w.*sinc(W*t3);
hbpf = h.*cos(2*pi*fc.*t2);
figure;
plot(t4,x.*hbpf);
grid on

댓글 수: 1

Original question in case dummy erases this one too:
I keep getting the error message that vectors must be the same length in the plot command
fc = (f1 + f2)/2;
r = 2e10;
Bw = 2e8;
Tp = 5e-7;
t2 = 0:r*21:20;
t3=-10:r*10+1:10;
t4= 0:r*31:30;
W = Bw;
w = hamming(t2);
h = w.*sinc(W*t3);
hbpf = h.*cos(2*pi*fc.*t2);
figure;
plot(t4,x.*hbpf);
grid on

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

답변 (1개)

Jos (10584)
Jos (10584) 2019년 4월 5일
So, apparently the two vectors are not of the same length. You really should learn how to debug your own code. Set a breakpoint and step through the lines to see where things start to deviate from what you expect.
btw, without running your code, I assume that t2 is not what you expect it to be ...

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

제품

릴리스

R2019a

태그

질문:

2019년 4월 5일

댓글:

2019년 10월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by