How to select a part of a graph and have the data saved in a variable?
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello all, I have time history of measured data from some experiments (accelerations vs time). The experiments were a couple of hours. I want to do the following: Plot the whole time history of data, select a portion of it and have the data from that portion saved in a variable so that I can use it in my code to perform a FFT (fast fourier transform) on it. Does anyone know how I can have the selected data saved in a variable:
In other words:
- %data is the time history of the data
- Step 1- plot=data(:,1)
- Step 2- select some parts of data graphically (maybe using brush function?)
- Step 3- A= seleted data from the graph
- Step 4- FFT(A)
Thank you very much in advance.
1 comentario
Respuestas (1)
KSSV
el 19 de Sept. de 2017
You may plot and select the data of your interest as below:
N = 100 ;
x = (1:N)' ;
y = rand(N,1) ;
plot(x,y) ;
hold on
pts = ginput(2) ;
%%pick the data which was picked via ginput
idx = knnsearch([x y],pts) ;
xi = x(idx(1):idx(2)) ;
yi = y(idx(1):idx(2)) ;
plot(xi,yi,'.r') ;
legend('data','data picked')
For Fourier Transform Analysis read about fft. It is a straight forward task.
0 comentarios
Ver también
Categorías
Más información sobre Data Exploration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!