How to analyze part of a signal?
2 次查看(过去 30 天)
显示 更早的评论
Hello, I have created a sinusoidal signal, but I only want to find a peak value between 'x' to 'y' seconds of the signal. How would I set a limit so that only the data of the sinusoidal signal is analyzed in MATLAB between 'x' to 'y' seconds?
I have tried to use the function "xlim", but I think that is only for setting limits on a graph.
I hope this is not to broad of a question, but any help would be greatly appreciated.
0 个评论
回答(2 个)
dpb
2017-3-22
Index into the result vector based on values of time; if you have a fixed timestep then it's simply T/dt intervals past T0 or the delta is (Tend-Tstart)/dt points.
Then, "Use the colon, Luke!"
ymax=max(y(idxStart:idxEnd));
where you've just computed the two indices above.
Alternatively, there is (beginning R2015a, anyway) a timeseries class that has the ability to retrieve data by time and methods to manipulate data that potentially could be simpler coding. I've not 'spearminted with it to date so no real firsthand data with to really recommend for/against the implementation; just know it exists.
5 个评论
dpb
2017-3-23
I'm not sure who x is here; the abscissa or ordinate for the time series? Where does m1 come from in the above; why are you searching for a specific value?
You may want to study
doc findpeaks % it has many options for peak-finding with conditions
AJ Woodson
2020-11-3
If I have signal X for say the if want to take a portion of that signal you could do something like b = X(beginPoint:DesiredEnd)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Signal Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!