comparison plotConvergenceFit.m @ 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
children 0ef8965dd745
comparison
equal deleted inserted replaced
37:1770689d6c31 38:4fcc4448682f
1 % Draws a line in a loglog plot with slope `slope` and position `pos`
2 % and `width` orders of magnitude wide.
3 % ex: pos = [1e-1 1e-4]
4
5 function hand = plotConvergenceFit(slope, pos, width)
6 x0 = pos(1);
7 y0 = pos(2);
8
9 x = [x0*10^-(width/2) x0*10^(width/2)];
10 y = x.^slope * x0^-slope * y0;
11
12 hand = line(x,y);
13 hand.Color = Color.black;
14 hand.LineStyle = '--';
15 hand.LineWidth = 2;
16 end