How to add a top x-axis related to non-linearly to the bottom x-axis?

2 ビュー (過去 30 日間)
JM
JM 2018 年 2 月 5 日
コメント済み: dpb 2018 年 2 月 6 日
Lets say I have
x1 = [-100:100];
y1 = sin (X1);
plot (x1,y1);
now how to add a top x-axis with x labels which are
constant./x1
where the constant can be 1 or any other number?

回答 (1 件)

dpb
dpb 2018 年 2 月 5 日
Similar to another just answered <How-to-plot-a-graph-for-one-set-of-data-against-two-y-axes-one-a-function-of-the-other> excepting was the second y-axis so could use yyaxis as start point (why there isn't its twin sister is anybody's guess...).
However, there is an example for "Multiple x- and y-axes" in the documentation for graphics that shows how to create the second overlaying axis; use that then the shown ideas above for the x-limits and x-tick values. Will have to use the venerable graphics handles to address the correct axis since there isn't a xxaxis for convenience (again, why not, TMW?).
  2 件のコメント
JM
JM 2018 年 2 月 6 日
Thanks but I would appreciate a working script with my example please. I have tried the suggestions I can find on the web.
dpb
dpb 2018 年 2 月 6 日
What have you tried and where did you get stuck doing what's in the examples pointed at?

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

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by