フィルターのクリア

how can i include both linear and logarithmic scales in one plot???

16 ビュー (過去 30 日間)
hassan elkholy
hassan elkholy 2020 年 10 月 14 日
コメント済み: yogesh sahu 2023 年 3 月 15 日
how can i include both linear and logarithmic (dB) scales in one plot
code
figure;
plot(w,20*log10(abs(p)))
grid

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 10 月 14 日
If you just have one line to be plotted and you want one axes to be linear and the other to be log, then you can use semilogx() or semilogy() to do the plotting.
Those functions are plot() calls followed by setting the axes 'XScale' or 'YScale' properties to 'log' instead of the default linear.
If you want to have one line that is linear scale and another line that is log scale in the same plot, then you will need to use multiple axes in the same plot. The newer way to do that is yyaxis left and yyaxis right and use plot() or semilogx() or semilogy() as appropriate. The older way to do it is to use plotyy() -- you can specify one of the lines as plot() and the other as semilog*() as appropriate.

カテゴリ

Help Center および File ExchangeTwo y-axis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by