Mercurial > repos > public > sbplib
changeset 38:4fcc4448682f
Added function for drawing fitting lines to convergence plots.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 06 Oct 2015 16:54:54 +0200 |
parents | 1770689d6c31 |
children | 7249f105e67b |
files | plotConvergenceFit.m |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
diff -r 1770689d6c31 -r 4fcc4448682f plotConvergenceFit.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plotConvergenceFit.m Tue Oct 06 16:54:54 2015 +0200 @@ -0,0 +1,16 @@ +% Draws a line in a loglog plot with slope `slope` and position `pos` +% and `width` orders of magnitude wide. +% ex: pos = [1e-1 1e-4] + +function hand = plotConvergenceFit(slope, pos, width) + x0 = pos(1); + y0 = pos(2); + + x = [x0*10^-(width/2) x0*10^(width/2)]; + y = x.^slope * x0^-slope * y0; + + hand = line(x,y); + hand.Color = Color.black; + hand.LineStyle = '--'; + hand.LineWidth = 2; +end \ No newline at end of file