% beam_example.m % Create a vector of 1000 equally spaced points % and plot y1 = tan(x) and y2 = x on same graph. x = linspace(0,12,1000); y1 = tan(x); y2 = x; plot(x,y1,'-', x,y2,'--') axis([0,12,0,12]) opt = optimset('TolX', 1e-7); e = 0.00001 f = @(x) tan(x) - x; fzero(f, [pi, pi + pi/2 - e], opt) fzero(f, [2*pi, 2*pi + pi/2 - e], opt) fzero(f, [3*pi, 3*pi + pi/2 - e], opt)