MATLAB Examples

Contents

Create a figure and add a demo curve

figure(1)
clf
t = 0:pi/64:4*pi;
plot(t,sin(t))

Add a line

Using the default values to make a horizontal line through the origin

customGrid('YGrid',0)

Add some more lines

Also give them a custom appearance.

h=customGrid(gca,'XGrid',[0 1 5 6 7],'YGrid',[1 0.4 1.5],'Color',[1 0 1 ],'LineStyle',':','LineWidth',2);

And now some curves

for q=1:6
    y{q}=q/6*cos(t);
    x{q}=q^2/15*sin(t)+6;
end
h=customGrid(gca,'XCurve',x,'YCurve',y,'Color','g','LineStyle','-','LineWidth',.1);
axis square

Delete some lines

customGrid('clear',h(1:3))

Delete them all

customGrid('clear')