Why there is discontinuity between the signals and the specified frequencies do not appear as stated

余生长醉 提交于 2019-12-12 03:25:31

问题


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

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- 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.

Kindly please clarify these points.

Code

% 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:


A frequency of 15 means 15 periods per time unit. So in 1/4th of a time unit, you would have only 15/4 periods. And obviously, in 3 time units, you'd have 3*15 periods.

As for the signal continuity, you've added every element of x1 to its corresponding element in x2 (where corresponding means .25 later). And both sines in turn are added to x3. Hence, x4 ends as the sum of 4 sines.

Making them contiguous isn't exactly trivial; you'd need to fix the phase of x2.




回答2:


1- The period of x1 signal is 1/15. Time duration of this signal is 0.25 secs. So How many period we will see? Simply, 0.25 / (1/15) = 3.75 periods means almost complete 4 periods. This means we can see 4 peaks of it.

2- All of signals end at different amplitude value corresponding you specified time duration. You should find proper moments of time when signals have same amplitude value if you want them to look like continuously.




回答3:


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- 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);

Alternatively, this also works

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


来源:https://stackoverflow.com/questions/27678678/why-there-is-discontinuity-between-the-signals-and-the-specified-frequencies-do

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!