Plot of head against velocity data based on timestamp similarity

1 回表示 (過去 30 日間)
muhammad choudhry
muhammad choudhry 2022 年 3 月 10 日
コメント済み: Jon 2022 年 3 月 10 日
Hi,
I have 2 excel files named TimeStamps_Uy.xlsx and Head_Timestamps.xlsx. In file one: TimeStamps_Uy.xlsx column 1 have a Timestamps and column 2 have the velocity data. In file two: column 1 have a Timestamps and column 2 have the Head data. I want to use TimeStamps_Uy.xlsx file and all of its Timestamps to fine the similar Timestamps in the Head_Timestamps.xlsx hence on matching plot the corresponding data (head/Uy) from both files column 2 for the same or near enough time stamp hence save the timestamp, head, and Uy into new xlsx or csv file. How would I do that? I have attached both the xlsx file in this post. I have tried but getting nowhere! Code below is just show the path and normal reading of data from column.
Code so far:
Uy_dir = 'F:\3-PIV_Experimental_Data\Outlet_110\Data_LaserSheet_D\Data_PIV\5-AverageFilter_VelocitiesExtration\Point_Velocities\Uy\TimeStamps_Uy.xlsx';
a = readmatrix(Uy_dir);
x=a(:,1);
y=a(:,2);
Head_dir = 'F:\3-PIV_Experimental_Data\Outlet_110\Data_LaserSheet_D\Data_Head\Data_Raw\Head_Timestamps.xlsx';
a = readmatrix(Head_dir);
x=a(:,1);
y=a(:,2);

採用された回答

Jon
Jon 2022 年 3 月 10 日
編集済み: Jon 2022 年 3 月 10 日
First read in both of your datafiles.
Then use MATLAB function interp1 to interpolate values at times matching the times in one of the data files (doesn't matter which one)
So suppose that you have vectors tu, u for times and corresponding velocities and also th, h for times and corresponding head values. Then you could interpolate values of head at times matching those in the velocity data using
hq = interp1(th,h,tu)
and then if you wanted to plot head vs velocity you could plot the interpolated head values against the velocity values
plot(u,hq)
  7 件のコメント
muhammad choudhry
muhammad choudhry 2022 年 3 月 10 日
Thanks alot for the explaination, yes I have accepted the answer. Thanks again!
Jon
Jon 2022 年 3 月 10 日
Great, good luck with your experiment.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by