NEED HELP, Need to find the period for a signal
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I have the following signal:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1343854/image.png)
I need to write a Matlab code to find the period T.
And plot the signal for 0 <= t <= T.
Can anyone Help?
Thank You in Advance!!
0 个评论
回答(1 个)
Antoni Garcia-Herreros
2023-4-3
Hello Mohammad,
clear all
ts=0.001;
t=0:ts:0.6;
y=5*sin(8*pi*t)+6*sin(16*pi*t);
[p,peaks]=findpeaks(y,'MinPeakProminence',(max(y)-min(y))/4);
Period=mean([diff(peaks(1:2:length(peaks))), diff(peaks(2:2:length(peaks)))])*ts
Or you could work your way arround using autocorrelation
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Signal Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!