How do I set the value of Y axis =0.02, and the plot will show me the value of x?

16 ビュー (過去 30 日間)
Seow Yen Yew
Seow Yen Yew 2021 年 11 月 7 日
回答済み: Star Strider 2021 年 11 月 7 日
Hello guys, I wanna the value of X-axis when the Y-axis is at exactly 0.02, at C=80. How can I do that. Because when I move the cursor manually on the plot, I cant get a Y-axis value exaclty =0.02.

回答 (1 件)

Star Strider
Star Strider 2021 年 11 月 7 日
Use the interp1 function —
x = logspace(-1, 2, 50);
y = -x.^3;
yi = -0.02;
xi = interp1(y, x, yi)
xi = 0.2710
figure
loglog(x, y)
hold on
plot(xi, yi, 'r+', 'MarkerSize',10)
plot([min(xlim) xi], [1 1]*yi, '--k')
plot([1 1]*xi, [min(ylim) yi], '--k')
hold off
grid
.

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by