How the error value appears in the graph?

Hello, I am trying to plot the difference between two polynomials some of graphs I could not get the value of the error on it like the following graph.
so what I can do to make the value of the error appears in the graph?
Error=abs(p1-p2);

1 件のコメント

Rik
Rik 2018 年 3 月 7 日
What is the code that you are using and how exactly to do want the error to be shown?

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

 採用された回答

Walter Roberson
Walter Roberson 2018 年 3 月 7 日

0 投票

hold on
plot(x, Error, 'r')
where x is the name of the variable being used for the x axis.
Note that it is possible that the error is small enough that it would not be visible on the graph except as a (red) line against the bottom. For example if the error were about 1E-15 then it would only be 1/10000 the span of your y axes.

5 件のコメント

Momo
Momo 2018 年 3 月 7 日
編集済み: Momo 2018 年 3 月 7 日
Yes, I did that with different values for the coefficients of the polynomial but not all the graphs have the number in the corner (X10^-11), I want to show this number in all cases.
Rik
Rik 2018 年 3 月 7 日
You mean you want to show x10^0? That is not an error, that is a scale for the y-axis.
Momo
Momo 2018 年 3 月 7 日
編集済み: Momo 2018 年 3 月 7 日
yes, how can I show it?
Walter Roberson
Walter Roberson 2018 年 3 月 8 日
ax = gca;
ax.YAxis.Exponent = 0;
this would disable using the exponent on the Y axis.
If you use a value other than 0 then that exponent will be used; for example you can use a value of -1 or 1.
However, if you want 10^0 to be specifically marked then you have to use an exponent of 0 and then text() the 10^0 into place.
Momo
Momo 2018 年 3 月 8 日
Thank you so much

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDiscrete Data Plots についてさらに検索

タグ

質問済み:

2018 年 3 月 7 日

コメント済み:

2018 年 3 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by