0

所以我在调制后无法绘制这个 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
4

1 回答 1

1

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

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

SSBff(1000:1800) = 0;
于 2016-10-06T17:13:18.157 回答