How to set the x-aixs when plotting with certain row and column of matrix

4 ビュー (過去 30 日間)
hyejin Kwon
hyejin Kwon 2019 年 3 月 19 日
コメント済み: hyejin Kwon 2019 年 3 月 20 日
My Matrix 702x22, and include spectra data.
There are spectra data along the frequency at the different time.
So, the first column is frequency and the first row is time.
I want to plot gragh 2:702 row and 2:22 column.
figure(1),plot(matrix_a(2:702,2:22))
I got the graph that I've expected except the x-axis scale.
Its x-axis scale is just numeric order, 0 to 800.
How can I change the x-axis to the frequecy value which is on the first column?

採用された回答

Adam
Adam 2019 年 3 月 19 日
I'm surprised you can see anything useful on that using plot rather than an image, but the plot function takes multiple arguments, as shown in the documentation:
doc plot
If you don't give it explicit x data then it will just use indexing so you can instead use e.g.
plot( linspace( 0, 1, 701 ), matrix_a(2:702,2:22) );
or whatever it is you want to plot on the x axis. I don't know what your actual frequencies are.
  1 件のコメント
hyejin Kwon
hyejin Kwon 2019 年 3 月 20 日
I figured it out in this way below.
plot(matrix_a(2:702,1),matrix_a(2:702,2:22))
It worked this way. After founding the answer, I felt like it was just simple stting x data things.
I don't need to create new matrix for frequency, for frequency values I need are already in the matrix_a.
Thank you anyway!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by