所以我在调制它之后有麻烦地绘制这个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
答案 0 :(得分:1)
t仅由201个元素组成;从k = 1000到1800将SSBff(k)设置为零会将SSBff的大小增加到1800个元素。 1800 = / = 201.您应该增加t的定义,以便拥有更多元素,或者将您设置的SSBff的哪些部分更改为零
另外,你的for循环也可以用一行调用
if (disc < 0) disc2 = -disc;
else disc2 = disc;
root = sqrt(disc2);