function [ y1 y2 ] = agnesi (a) # Beräkna x = linspace(-17, 17, 100) ; y0 = 8*a.^3./(x.^2 + 4*a.^2); # Följande kod för att rita en cirkel bygger en generellt funktion som finns att hämta här: # http://www.mathworks.com/matlabcentral/fileexchange/2876-draw-a-circle # Men lyftes in här lite modifierad för att hålla allt i en fil. center = [0,a/2]; radius = a/2; NOP = 100; THETA = linspace(0,2*pi,NOP); RHO = ones(1,NOP)*radius; [X,Y] = pol2cart(THETA,RHO); CX = X+center(1); CY = (Y+center(2)); # Rita plot(CX,CY,x,y0,x,a); endfunction