Trying to plot two vectors of unequal lengths on the same X and Y axes

3 ビュー (過去 30 日間)
Michael Bochert
Michael Bochert 2025 年 1 月 25 日
Hello, I am trying to plot two vectors of unequal lengths on the same set of axes. One potential solution I have thought of is to bin the longer vector, such that the number of bins equals the length of the smaller vector. Then, I could take the average within each bin. However, I dont know how I would go about doing this, or if there is some other way.
I would appreciate any help in trying to figure this out! Thank you!

回答 (1 件)

Star Strider
Star Strider 2025 年 1 月 25 日
There is probably no good way of doing this without compromising the data in some way.
The way I would choose would be to to use the interp1 function to equalise thier lengths. How you choose to do that (shortening the longer vector or lengthening the shorter vector) is your choice. Either way, this creates data where none previously existed.
There might be a better way, however knowing nothing about your vectors, I cannot determine what that may be.

カテゴリ

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

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by