# Determine periodicity of a signal x(t)=4sin (2 pi t /7 )+ 5 sin (2 pi t/9)

6 views (last 30 days)
Pratham A on 18 Oct 2020
Commented: Pratham A on 18 Oct 2020
Im new to matlab and im confused whether this is to be solved using autocorelation or fft.

#### 1 Comment

KSSV on 18 Oct 2020
You have to use fft. You have example inthe doc, you can easily do it on youe self.

Image Analyst on 18 Oct 2020
This is not a MATLAB question. It doesn't even need fft or correlation. If you do FFt, you'll simply see two spikes, one for one signal and one for the other signal. It's just basic math. Since the period of one is 7 and the other is 9, what do you think the repeat period would be? Don't think about spectra or programming. Just think about things like least common multiple or whatever.
If you want MATLAB code to visualize the signal, here it is:
t = linspace(0, 63 * 4, 1000); % Four repeated cycles
x = 4 * sin(2 * pi * t / 7) + 5 * sin(2 * pi * t / 9);
plot(t, x, 'b-', 'LineWidth', 2);
grid on;
xlabel('t', 'FontSize', 15);
ylabel('x', 'FontSize', 15);
for k = 0 : 63 : max(t)
xline(k, 'Color', 'r', 'LineWidth', 2);
end
g = gcf;
g.WindowState = 'maximized'

#### 1 Comment

Pratham A on 18 Oct 2020
Thanks for the help, i understand that the time period would actually be the least common multiple. However the issue here is that i have solved it on paper however im supposed to verify my answer using matlab. When i just include the intial or the later part of the signal matlab gives the the right answers (7 and 9)
t= 0:0.01:1000
xct= 4*sin(2*pi*t/7);
figure;
plot(t,xct);grid;
ac= xcorr(xct,xct);
[~,locs]=findpeaks(ac);
mean(diff(locs)*0.01)
however when i use the full equation in this code it gives the aswer as 9.0086 which is incorrect, i was wondering if theres a method for it to display the time period for the full equation [ 4 sin (2 pi t /7) + 5 sin (2 pi t /9)