Borrar filtros
Borrar filtros

Inscribed n-gon of unit circle.

3 visualizaciones (últimos 30 días)
Jim Oste
Jim Oste el 10 de Feb. de 2015
Respondida: Image Analyst el 10 de Feb. de 2015
I was given the following code to determine the length of a polygonal curve
function [ len ] = ost_len( x,y )
%Length of polygonal curve.
% This function computes the length of the polygonal curve whos ith
% ith vertex has Cartesian coordinates x(i) and y(i)
x = rand(1, 5);
y = rand(1, 5);
dx = abs([diff(x), x(end)-x(1)]);
dy = abs([diff(y), y(end)-y(1)]);
dist = sqrt(dx.^2 + dy.^2);
len = sum(dist);
disp(len)
end
I am now somehow supposed to calculate the length of an inscribed n-gon for a unit circle for n=2^i, where i = 2,3,...,8.
Would the function given help me or do I need to alter it?

Respuesta aceptada

Image Analyst
Image Analyst el 10 de Feb. de 2015
Well obviously for an inscribed n-gon, you wouldn't want to use random x and y so get rid of those lines. Those were just sample data that were created. You have to replace it with points on the unit circle. I assume you know how to use sin() and cos() so this will be no problem for you.

Más respuestas (0)

Categorías

Más información sobre Computational Geometry en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by