How do I Plot error on a graph

7 views (last 30 days)
AgonW
AgonW on 2 Mar 2020
Edited: Adam Danz on 1 Aug 2022
Hi,
I want to plot an error on the below graph, a high error and a low error.
Note from the graph the least squares line, and the deviaiton aboce and below this line increasing along with the x-axis.
I have tried using errorbar(x,y,err) but i do not know how to calculate 'err' variable that is moving.
Any help would be greatly appreciated.
  3 Comments
Poongavanam Palani
Poongavanam Palani on 1 Aug 2022
Have you tried Andrewsplot or boundedline package available in MATLAB repository. I am guessing it is the standard deviation that you are referring to here.
Link: http://www.mathworks.com/matlabcentral/fileexchange/27485-boundedline-m
Adam Danz
Adam Danz on 1 Aug 2022
Edited: Adam Danz on 1 Aug 2022
"Error" does not have a single definition. There are lots of ways to define error. Standard deviations, confidence intervals, quartiles, etc. You could show error along the x axis or y axis or variation of the fitted slope using cross validation etc. And the choice isn't arbitrary. The choice should be made based on the story you're telling with the data and the properties of your data. After you decide on what "error" means in your data, computing the error is relatively straight forward and plotting it is even easier, and you can get help with that here.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!