简体   繁体   English

绘图误差向量的长度必须相同

[英]Plottng Error Vector Must Be Same Length

So I'm Having Trouble graphing this SSB signal after I modulated it. 因此,在调制此SSB信号后,我无法对其进行图形处理。 I keep getting the Vector Length error. 我不断收到向量长度错误。

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

So right here below is the graph I'm having trouble with. 因此,下面是我遇到的图表。 I don't understand why My vector Lengths are off. 我不明白为什么我的向量长度不可用。

%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 is only made up of 201 elements; t仅由201个元素组成; setting SSBff(k) to zero from k = 1000 to 1800 increases the size of SSBff to 1800 elements. 将k = 1000至1800的SSBff(k)设置为零可将SSBff的大小增加至1800个元素。 1800 =/= 201. You should either increase your definition of t so you have more elements, or change what portions of SSBff you're setting to zero 1800 = / =201。您应该增加t的定义,以便有更多元素,或者将您设置为零的SSBff部分更改为零

As an aside, your for loop can also be called with the one line 顺便说一句,您的for循环也可以用一行来调用

SSBff(1000:1800) = 0;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM