x = linspace(0, 2*pi, 30); y = sin(x); z = cos(x); plot(x,y,x,z) grid xlabel( 'Independent Variable X') % x-axis label ylabel( 'Dependent Variables Y and Z') % y-axis label title(`Sine nad Cosine Curves') % title the plot text(2.5, 0.7, 'sin(x)') gtext('cos(x)') axis off axis on, grid off axis ij axis ('square', 'equal') axis ('xy', 'normal') x = linspace(0, 2*pi, 30); y = sin(x); z = cos(x); plot(x,y) hold on plot(x,z,'m') hold off % ezplot('sin(x)/(1+x^2)') fplot('sin(x)/(1+x^2)') fplot( @(x) sin(x)./(1+x.^2)), grid % ezplot('2*cos(t)','2*sin(t)') fplot(@(t) 2*cos(t), @(t) 2*sin(t)), grid % ezplot('x^2+y^2-4') fimplicit(@(x,y) x.^2 + y.^2 -4) fimplicit(@(x,y) x.^2 + y.^2 -4), grid, axis equal, axis([-3 3 -3 3]) ezpolar('sin(t)/t', [-6*pi,6*pi]) % ezplot('(sin(t)/t)*cos(t)','(sin(t)/t)*sin(t)',[-6*pi,6*pi]) fplot(@(t) (sin(t)./t).*cos(t), @(t) (sin(t)./t).*sin(t), ... [-6*pi,6*pi], 'LineWidth', 2), grid % h1 = ezplot3('cos(2*pi*t)','sin(2*pi*t)','t',[0,4]) h1 = fplot3( @(t) cos(2*pi*t), @(t) sin(2*pi*t), @(t) t,[0,4]) h1.LineWidth = 2; h1.Marker = 'square'; get(gca) set(gca, 'Color', [0.8 0.8 0.8], 'ZLim', [-0.5 5]) %ezsurf('x*y*exp(-(x^2+y^2))') fsurf(@(x,y) x.*y.*exp(-(x.^2+y.^2))) fsurf(@(x,y) x.*y.*exp(-(x.^2+y.^2)), [-3 3 -4 4]) %ezsurfc('x*y*exp(-(x^2+y^2))') %ezmesh('x*y*exp(-(x^2+y^2))') %ezmeshc('x*y*exp(-(x^2+y^2))') %ezcontour('x*y*exp(-(x^2+y^2))') %ezcontourf('x*y*exp(-(x^2+y^2))') %ezsurf('s*cos(t)', 's*sin(t)', 't', [.4,1], [0,6*pi]) %ezsurf('s*cos(t)', 's*sin(t)', 'floor(t)', [.4,1], [0,6*pi]) % fplot('cos', [0 3*pi]) fplot(@cos, [0 3*pi]) % fplot('sin(z)', [0 3*pi]), grid fplot(@sin, [0 3*pi]), grid % fplot('[cos(x), sin(x)]', [0 3*pi]), grid fplot(@(x) [cos(x), sin(x)], [0 3*pi], 'LineWidth', 2), grid [x,y] = fplot( @(x) cos(x), [0 3*pi]); plot(x,y, '-*'), grid h2 = fplot(@(x) cos(x), [0 3*pi]); grid x = h2.XData; y = h2.YData; plot(x,y, '-*'), grid x = (0:1/2000:1)'; plot(x,cos(tan(pi*x))) %fplot('cos(tan(pi*x))', [0 1]) %fplot('cos(tan(pi*x))', [0 1], 1.0e-4) fplot( @(x) cos(tan(pi.*x)) ) function y = f02(x) y = cos(tan(pi*x)); % fplot('f02', [0 1]) fplot(@f02, [0 1]) x = 0:0.1:4*pi; z = [cos(x)' sin(x)' sin(x).^2']; plot(x,z) plot(peaks) plot(peaks, rot90(peaks')) y = 1:40; plot(peaks(40),y) subplot_demo, polar_demo, bar_demo, ginput_demo, fill_demo meshgrid([-2:1:2]) [X, Y] = meshgrid([-2:1:2]) [X, Y] = meshgrid([-2:.1:2]); Z = X.* exp(-X.^2 - Y.^2); plot3(X, Y, Z)