フィルターのクリア

Inscribed n-gon of unit circle.

3 ビュー (過去 30 日間)
Jim Oste
Jim Oste 2015 年 2 月 10 日
回答済み: Image Analyst 2015 年 2 月 10 日
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?

採用された回答

Image Analyst
Image Analyst 2015 年 2 月 10 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComputational Geometry についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by