How to select a part of a graph and have the data saved in a variable?
10 ビュー (過去 30 日間)
古いコメントを表示
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 件)
KSSV
2017 年 9 月 19 日
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 件のコメント
参考
カテゴリ
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!