1o paradeigma x=[0 1 1.5 2.2 3.] y=[0 1.65 1.45 1.4 1] plot(x,y) 2o paradeigma x=-pi:0.01:pi; y=cos(x); plot(x,y) 3o paradeigma x=linspace(-pi,pi, n); opou n=arithmos simeion pou theloume na parei y=cos(x); plot(x,y) % Μια συνάρτηση παρόμοια με τη linspace είναι η logspace η οποία παράγει διανύσματα με συνιστώσες που ισαπέχουν λογαριθμικά. Για παράδειγμα, >> logspace(0,2,3) 4o paradeigma-me vasi ta parapano paradeigmata edo dinoume stoixeia pou aforoun to grafima >> xlabel('x') >> ylabel('y=cos(x)') >> title('Graph of cosine in [-pi, pi]') >> legend('cos(x)') 5o paradeigma ezplot('exp(x)', -3, 3 ) ezplot('exp(x)') ezplot('1./(1+x.^2)') ezplot('x^2+y^2/4-1') ezplot('cos(t)', 'sin(t)',[0,2*pi]) ezplot('cos(t)', 'sin(t)',[0,0.75*pi]) 6o paradeigma >> t=0:pi/1000:8*pi; >> x=cos(t); >> y=sin(t); >> comet(x,y) 7o paradeigma-xrisi simvolon kai xromaton x=-pi:0.01:pi; y=cos(x); plot (x, y, 'g') x=-pi:0.01:pi; y=cos(x); plot (x, y, 'o') 8o paradeigma-pollapla grafimata >> x=0:0.02:2; >> y=sin(x); >> z=exp(x); >> plot( x, y, 'r', x, z, '--') >> grid >> legend ( 'sin(x)', 'exp(x)' ) >> x=0:pi/100:2*pi; >> Y=[cos(x); cos(x).^3; cos(x).^5]; >> plot(x,Y) >> legend('cos(x)','cos^3(x)', 'cos^5(x)') t=linspace(-2*pi,2*pi) f1=sin(t.^2); f2=(sin(t)).^2; f3=cos(t.^2); f4=(cos(t)).^2; subplot(2,2,1);plot(t,f1); title('sin(t^2)') subplot(2,2,2);plot(t,f2); title('sin(t)^2') subplot(2,2,3);plot(t,f3); title('cos(t^2)') subplot(2,2,4);plot(t,f4); title('cos(t)^2') paradeigma 9o-grafimata-ravdogrammata-istogramma >> x = -2.9:0.2:2.9; >> y=exp(-x.^2); >> bar(x,y) >> colormap cool >> y=randn(10000,1); >> hist(y) >> grid %se epomenes parousiaseis %me 2 aples entoles paragoume entiposiaka grafimata(i entoli ezsurf gia 3d grafimata) z = @(x,y) cos(x).*cos(y); ezsurf(z)