For k 0 1 n 1 For example if a regular pentagon haSolution

For k = 0, 1, ..., n -1. For example, if a regular pentagon ha

Solution

Task 1 :


function [] = draw(n,R,O)

X = zeros(1,n);
Y = zeros(1,n);

for ii = 1:n
  
    X(ii) = O(1) + R*sin (ii*2*pi/n);
  
    Y(ii) = O(2) + R*cos(ii*2*pi/n);
  
end

plot([X X(1)],[Y Y(1)]);

end

% MATLAB script ends here

Task 2:


% MATLAB script begins here

clc;
clear all;
close all;
figure;
for ii = 1:100
for jj = 1:100
  
    hold on;
    A = (ii-1) + [2*(jj-3)+2*cos( pi/3) 2*(ii-3)+2*sin(pi/3) ];
draw(6,1,A);
end
end

% MATLAB script ends here

Task 3:

Perfect round circle can not be produced using the draw function.

How ever the polygon becomes close to a round circle as the number of sides becomes large and large.

 For k = 0, 1, ..., n -1. For example, if a regular pentagon haSolutionTask 1 : function [] = draw(n,R,O) X = zeros(1,n); Y = zeros(1,n); for ii = 1:n X(ii) = O

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site