绘图错误向量必须相同长度

Plottng Error Vector Must Be Same Length

所以我在调制此 SSB 信号后无法绘制它。我不断收到矢量长度错误。

function SSB = SSBMOD

%Setting Up Variables
amplitude = 1; % Defining Amplitude
tau_in = 0.010; %Defining Tau
t_in = -0.010:0.0001:0.010; % Defining Time range
Fs = 27000; %Defining Carrier Frequency
Fc = cos(2*pi*Fs*t_in); %Carrier Signal
F = 1/t_in(end)*t_in*Fs*1.25; %Setting Up Frequency Vector for Graph
Sig = ProjectSig(amplitude,tau_in,t_in); %Calling Generated Signal output Function

%Modulating The signal Using SSB AM modulation
SSB = Sig.*Fc;
%Performing Fast Fourier Transform
SSBff = fft(SSB);
%Filter Signal to SSB
for k = 1000:1800
    SSBff(k) = 0;
end
%Inverse Fourier Transform to Obtain SSB Signal
SSBSig = ifft(SSBff);

%Plotting Original Signal
subplot(3,3,1);
plot(t_in,Sig,'b');
axis([t_in(1) t_in(end) -1 1]);
title('Original Signal');
xlabel('Time (Sec)');
ylabel('V(t) (V)');
grid
shg

下面是我遇到问题的图表。我不明白为什么我的矢量长度关闭了。

%Plotting SSB Signal
subplot(3,3,2);
plot(t_in,SSBSig,'b');
axis([t_in(1) t_in(end) -1 1]);
title('Single Sideband Signal');
xlabel('Time (Sec)');
ylabel('V(t) (V)');
grid
shg

end

t只由201个元素组成;将 SSBff(k) 从 k = 1000 设置为零到 1800 会将 SSBff 的大小增加到 1800 个元素。 1800 =/= 201。您应该增加 t 的定义以便拥有更多元素,或者更改要设置为零的 SSBff 的哪些部分

顺便说一句,你的 for 循环也可以用一行来调用

SSBff(1000:1800) = 0;