determine whether or not the following signals are periodic

조회 수: 11 (최근 30일)
Suraj Narayan
Suraj Narayan 2020년 10월 19일
댓글: Walter Roberson 2020년 10월 20일
clc
clear all
close all
t= -4 : 0.005 : 4;
a=1;
%FOR X(T)
subplot(2,1,1)
c1=2*pi;
c2=4*pi;
x2=a*cos(c1.*t);
x1=a*cos(c2.*t);
x=x1+x2
ac=xcorr(x,x);
[~,locs]=findpeaks(ac);
sol=mean(diff(locs)*0.1)
plot(t,x)
xlabel('time->')
ylabel('x(t)')
title('Plot For x(t)')
grid on
gtext('1841014009')
text(-1,-0.5, ['Period Of The Signal =', num2str(sol)])
%FOR Y(T)
subplot(2,1,2)
c1=2*pi;
c2=2;
y2=a*cos(c1.*t);
y1=a*cos(c2.*t);
y=y1+y2
ac=xcorr(y,y);
[~,locs]=findpeaks(ac);
sol=mean(diff(locs)*0.1)
plot(t,y)
xlabel('time->')
ylabel('y(t)')
title('Plot For y(t)')
grid on
gtext('1841014009')
text(-1,-0.5, ['Period Of The Signal =', num2str(sol)])
This is what i have done.
But i don't how to determine whether or not the following signals are periodic in MATLAB
  댓글 수: 6
Suraj Narayan
Suraj Narayan 2020년 10월 20일
Thank again it's agreat help.
Walter Roberson
Walter Roberson 2020년 10월 20일
A signal f(t) is periodic if there is a time-independent delay time, dt, such that for every given time t, f(t) = f(t+dt) -- a time at which it is back at exactly the same state. Because f(t) = f(t+dt) then it also follows that f(t) = f(t+2*dt), f(t) = f(t+3*dt) and so on. The minimum interval dt for which the situation holds, is the "period" of the signal.
This definition can sometimes be more useful than the ratio of the periods. In particular for cos(f*t), there is an explicit formula:
>> expand(cos(f*t+dt))
cos(dt*f)*cos(f*t) - sin(dt*f)*sin(f*t)
And if we let dt*f be a multiple of 2*pi then cos(dt*f) would be 1 and sin(dt*f) would be 0, and the result would be the same as cos(f*t) no matter what t is, so this would be periodic.
It can be worth spending a few minutes to determine whether there is a smaller dt than dt = 2*pi/f .
For signals at two different frequencies, they will both be back at their original state at lcm() [Least Common Multiple] of the two dt values.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2020년 10월 19일
plot(t,x)
That should be plot(t,y) the second time.
sol=mean(diff(locs)*0.1)
why 0.1 ?
Finding the average difference between peaks in the correlation matrix does not tell you whether the signal is periodic.
Consider for example a square wave signal that pulses on for one unit, and each time the distance between pulses gets one unit further apart:
|^|_|^|__|^|___|^|____|^|_____|^|
The correlation measurement will have peaks that are not a constant distance apart, but despite not being constant distance, the mean of the distance is going to be some number. Like mean([1,3,6,10,15,21]) -> 9+1/3 . mean() of a series of values is always defined unless the values are empty or nan -- but the fact it exists does not tell you that the signal is periodic.
  댓글 수: 1
Suraj Narayan
Suraj Narayan 2020년 10월 19일
편집: Suraj Narayan 2020년 10월 19일
Thank you
Yes, that should be plot(t,y).
Thanks for letting me know, And for why? 0.1 is wrong.
I'm a beginner to MATLAB, so there are a lot of mistakes.
As for where I got that idea, please follow the link

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by