How to seperate similar data stacked up in one coulmn into multiple columns

2 ビュー (過去 30 日間)
Sai Gudlur
Sai Gudlur 2018 年 12 月 11 日
回答済み: Sai Gudlur 2018 年 12 月 11 日
Hello,
I have two Cloumns of data which have number. Floating point integers just as below.
Column 1 (Torque)= [1.5555;2.6666;3.555....................];
Column 2 (displacement) = [1.2544,-25666,12.6655................];
Both are of same size. But these coulmn's have multiple iterations stacked up together. I mean Measurement of the certain process has been repeated multiple times and the data of the these repetations was acquired as one run. My question
Q) How do i compare values within the same column and seperate when the first measurement was done and next measurement begins (Sweep). And its corresponding Column 2 values and write it into a seperate coulmn.
Important info: so when the first iteration is performed lets say we get 20 data points. Now the 21st data point is when the 2nd iteration begin but the problem is both Column 1(Torque) and Column 2 (Displacement) data would not be exactly same they could differ upto 1 - 10% fromt the first data point. How could i automate my seperation and write the 2,3rd.... into new columns with there seperate headers. Have attached data file if looking at the data helps you suggest better.
Thanks
Anand
  3 件のコメント
Sai Gudlur
Sai Gudlur 2018 年 12 月 11 日
編集済み: per isakson 2018 年 12 月 11 日
dpb: Thanks a lot taking your time and helping me. But what would a time vector do? I was running the test and i am absolutely sure that i did not run all the sweeps in equal time periods. So time stamp can't be by reference. So as suggested i have attaching a data file. Please find the attached file.
dpb
dpb 2018 年 12 月 11 日
I was presuming the data acq could have a retrigger function that could timestamp from the triggers...if it's just a continuous time from first, then it would be of no real use for the purpose, granted.

サインインしてコメントする。

採用された回答

dpb
dpb 2018 年 12 月 11 日
This is going to be somewhat of a pain in the proverbial appendage...it's not even clear what constitutes an iteration for certain...the probable thing is one of two alternatives given the first column data look something like a sine wave would be to try to find the larger peaks via findpeaks eliminating the noise by using the 'MinPeakDistance' parameter to pick only those peaks that are the major fluctuations. Alternatively, before doing anything else a significant smoothing might be in order.
The alternative could be to use the known number of cycles to partition the data arbitrarily into sections that match roughly the length of the signal buried in the total time history and then use xcorr on subsections to calculate the lag at the max correlation to know the shift offset that most nearly matches up the two segments. This is then repeated for the number of segments. This has the benefit of find a "best fit" in an overall sense whereas the former is a single point that happens to be the max for each location.
L=length(data(:,2)); % how long the signal is in samples
[~,lpks]=findpeaks(anan(:,2),'minpeakheight',-2.5,'minpeakdistance',L/4); % find peak locations
[~,lvls]=findpeaks(-anan(:,2),'minpeakheight',-2.5,'minpeakdistance',L/4); % and valleys
findpeaks(anan(:,2),'minpeakheight',-2.5,'minpeakdistance',L/4); % use default behavior of plotting
hold on
plot(lvls,anan(lvls,2),'r^','markersize',8,'MarkerFaceColor','r'); % add the valley locations
untitled.jpg

その他の回答 (1 件)

Sai Gudlur
Sai Gudlur 2018 年 12 月 11 日
Thanks a lot this worked.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by