test file

1
function [P] = polyprop(test) %This is primary function x = test(:,1) y = test(:,2) polygon.numsides = length(test) polygon.area = area(test) polygon.perimeter = perimeter(test) polygon.centroid = centroid(p) polygon end %polyprop function per = perimeter(test) for i = 1:length(test); tot = 0; % Y = 1:length(y); tot = tot + sqrt((x(i)-x(i+1)).^2 + (sqrt(y(i)-y(i+1)).^2)) per = tot end end function[A] = polyarea(x) a=0; alpha = length(x) - 1; for i = 1:alpha; a = a + abs((x(i,1).*x(i+1,2) - x(i+1,1).*x(i,2))); end [A] = .5.*a; end

Upload: nick-clark

Post on 16-Aug-2015

9 views

Category:

Documents


2 download

DESCRIPTION

file

TRANSCRIPT

Page 1: test file

function [P] = polyprop(test) %This is primary functionx = test(:,1)y = test(:,2)polygon.numsides = length(test)polygon.area = area(test)polygon.perimeter = perimeter(test)polygon.centroid = centroid(p)polygonend %polyprop function per = perimeter(test) for i = 1:length(test); tot = 0; % Y = 1:length(y); tot = tot + sqrt((x(i)-x(i+1)).^2 + (sqrt(y(i)-y(i+1)).^2)) per = totend endfunction[A] = polyarea(x)a=0;alpha = length(x) - 1;for i = 1:alpha; a = a + abs((x(i,1).*x(i+1,2) - x(i+1,1).*x(i,2)));end [A] = .5.*a;end