You are on page 1of 1

function a=areagauss(x)

x=input('ingrese las coordenadas de la figura: ')


x
n=rows(x)
x=[x;x(1,:)]
s=x(n,1)*x(n+1,2)
for i=1:1:n-1
s=s+x(i,1)*x(i+1,2)
end
s;
d=x(n+1,1)*x(n,2)
for i=1:n-1
d=d+x(i,2)*x(i+1,1)
end
d;
a=1/2*(abs(s-d));
plot(x(:,1),x(:,2))

You might also like