Refresh FFT plot when time signal is panned

2 visualizzazioni (ultimi 30 giorni)
Aitor
Aitor il 17 Mag 2024
Commentato: Adam Danz il 20 Mag 2024
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

Risposte (1)

Adam Danz
Adam Danz il 17 Mag 2024
Modificato: Adam Danz il 17 Mag 2024
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
  1. Set the initial x-limits and store the xlim values for each axes
  2. Assign a LimitsChangedFcn to the axes that you want to interact with*
  3. 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.
* 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 Commenti
Aitor
Aitor il 20 Mag 2024
Thanks @Adam Danz, I do not know if this will work with the example I want to create . the 4 plots are "linked" to each other.
1-Raw data
2-RMS of the raw data every 125ms
3- 1/3 octave band of the whole raw data
4- FFT of the whole raw data
The idea is to copy the "same behaviour" of the signal analyzer--> If a portion of the signal 1 is taken (via zoom) for example, from second 25 to 30, the plot 3 and 4 must be updated and calculate the 1/3 and FFT of the 25-30seconds span signal
Attached the code I am using. Sorry for my lack of knowledge
Adam Danz
Adam Danz il 20 Mag 2024
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.

Accedi per commentare.

Categorie

Scopri di più su Data Exploration in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by