为什么信号之间不连续并且指定的频率没有出现

为什么信号之间不连续并且指定的频率没有出现

本文介绍了为什么信号之间不连续并且指定的频率没有出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经生成了下面图像中张贴的非平稳信号,我有两个问题:

I have generated the non-stationary signals posted below in the image, and i have two questions:

1-为什么尽管红色的第一个信号x1的频率在代码第12行的公式中为15,却只有4个峰值?

1- Why the first signal x1, shown in red, has only 4 peaks despite its frequency which is 15 in the equation at line-12 of code?

2-为什么显示的信号之间不连续?换句话说,我希望这四个信号能够顺利链接,并且每个信号都在上一个信号终止的位置开始,但是并没有发生,例如,x1终止于.25,x2终止于.25但BUT和BOT彼此不接触.我希望每个信号都将在其结束的确切位置开始.

2- Why there is discontinuity between the signals shown? In other words, i expected the four signals to be linked smoothly and each signla starts where the previous one ends, but, that did not happens, and instead for an example, x1 ended at .25 and the x2 started at .25 in time BUT both does not touch each other. I expected every signal to start exactly where it preceeding one ends.

请澄清这些要点.

代码

% Time specifications:
Fs = 8000;                       % samples per second
dt = 1/Fs;                       % seconds per sample
StopTime = 2;                    % seconds
t = (0:dt:StopTime-dt);             % seconds

t1 = (0:dt:.25);
t2 = (.25:dt:.50);
t3 = (.5:dt:.75);
t4 = (.75:dt:1);

x1 = (10)*sin(2*pi*15*t1);
x2 = (10)*sin(2*pi*25*t2) + x1;
x3 = (10)*sin(2*pi*50*t3) + x2 ;
x4 = (10)*sin(2*pi*75*t4) + x3;
length(x1)
length(t1)
% Plot the signal versus time:
figure;
xlabel('time (in seconds)');
ylabel('Amplitude');
title('Signal versus Time');
hold on
plot(t1,x1,'r');
plot(t2,x2,'g');
plot(t3,x3,'b');
plot(t4,x4,'black');

推荐答案

1- 1秒钟内您不会绘制信号.取而代之的是将其绘制在1/4秒内.这就是为什么只有4个峰的原因.如果像这样t1 = (0:dt:1);那样将时间向量更改为跨越一秒,则您将拥有适当数量的周期.

1- You do not plot your signal over 1 sec. Instead you plot it over a 1/4 of a second. That is why there are only 4 peaks.If you would change your time vectors to span one second like this t1 = (0:dt:1);, you will have the appropriate amount of periods.

2-您的时间向量不会跨越每个信号的整数周期.因为它们都是罪过,所以您知道在一个周期(或一秒钟)之后,它们都将再次为0.利用这一点,将您的时间向量更改为类似的内容,即可解决您的问题:

2- Your time vectors don't span an integer period of each signal. As they are all sines you know that after one period (or one second), they will all be 0 again. Making use of that, changing your time vectors to something like this, will fix your problem:

t1 = (0:dt:.2);
t2 = (.2:dt:.4);
t3 = (.4:dt:.6);
t4 = (.6:dt:.8);

或者,这也可以

t1 = (0:dt:1);
t2 = (1:dt:2);
t3 = (2:dt:3);
t4 = (3:dt:4);

这篇关于为什么信号之间不连续并且指定的频率没有出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 04:08