- Set the initial x-limits and store the xlim values for each axes
- Assign a LimitsChangedFcn to the axes that you want to interact with*
- Use the callback function "syncxlim" defined in that demo to sync all of the x-axis limits any time one of the xlim values change.
Refresh FFT plot when time signal is panned
3 次查看(过去 30 天)
显示 更早的评论
Hello!
Could you help me please. I have plotted the time signal and the FFT of the entire time signal. The thing is that I want to zoom in a particular zone of the time signal and have the FFT of only that part of signal. Is it possible to do it? I mean, zoom in one of the two above plots and automatically refresh the plots below
Something similar as it is done in Signal Analyzer app
Thanks in advance
0 个评论
回答(1 个)
Adam Danz
2024-5-17
编辑:Adam Danz
2024-5-17
linkaxes is often used to link axes limits between multiple axes but in this case, your axes have different units and different spans of data. You could use the LimitsChangedFcn to set the xlim of each axes in response to a change in xlim within one of the axes. Here's a demo showing how to implement this suggestion:
Basic steps outlined in the demo
* If you only want to interact with the top two axes, apply the LimitsChangedFcn to those two axes and turn off default interactions on the remaining axes using disableDefaultInteractivity. But all 4 axes handles still need to be passed into the LimitsChangedFcn callback function.
2 个评论
Adam Danz
2024-5-20
I see, I have a better understanding now of how these data are related. Data in axes 2,3,4 are all derived from data in axes 1, if I am not mistaken. You can still use the limitsChangedFcn. You would assign it to the first axes. When the x axis limits change, it will recompute the values in the other axes based on the segment of values visible in the first axes.
For example, if you zoom the x axis to have limits of [25,30], the LimitsChangedFcn callback will compute the data in the other axes based on the XData and YData of the line in axes 1 segmented between x=25 and x=30. Then it will update those axes.
Unfortunately I don't have time to dig into your app but I hope this is enough to get you started.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!