【发布时间】:2014-12-28 15:40:47
【问题描述】:
我试图使用下面提到的代码实现的是,在一个图中绘制四个信号x1, x2, x3, x4,每个信号分别与t1, t2, t3, t4。这样,每四分之一秒的新信号就会被绘制出来,并且频率不同。但是,当我运行代码时,该图只显示一个空图。
请让我知道我在代码中缺少什么。
代码
% Time specifications:
Fs = 8000; % samples per second
dt = 1/Fs; % seconds per sample
StopTime = 1; % seconds
t = (0:dt:StopTime); % seconds
t1 = (0:dt:.25);
t2 = (.25:dt:.50);
t3 = (.5:dt:.75);
t4 = (.75:dt:1);
x1 = (10)*cos(2*pi*3*t1);
x2 = (20)*cos(2*pi*6*t2);
x3 = (30)*cos(2*pi*10*t3);
x4 = (50)*cos(2*pi*15*t4);
% Plot the signal versus time:
figure;
xlabel('time (in seconds)');
ylabel('Amplitude');
title('Signal versus Time');
plot(t,x1,'r');
plot(t,x2,'g');
plot(t,x3,'b');
plot(t,x4,'black');
【问题讨论】:
标签: matlab signal-processing fft wavelet