determine whether or not the following signals are periodic
18 views (last 30 days)
Show older comments
Suraj Narayan
on 19 Oct 2020
Commented: Walter Roberson
on 20 Oct 2020
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 Comments
Walter Roberson
on 20 Oct 2020
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.
Accepted Answer
Walter Roberson
on 19 Oct 2020
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.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!