Make a circle in square that is split 8x8 parts?

In summary, the conversation discusses a problem with creating a circle in a square cut in 8x8 using MATLAB. The speaker asks for assistance but also mentions that it may be a homework assignment. The conversation then delves into potential solutions and ideas, with the speaker ultimately figuring it out and expressing gratitude for the help.
  • #1
Lucas94
7
0
Member warned about posting with no effort and without the template
Sorry if i may sound little unclear, english is not my first langue. I I am looking for a way to create a circle that is in a square cut in 8x8 in matlab. I would be glad if someone could give me a hand.
Thanks!
 
Physics news on Phys.org
  • #2
Welcome to PF!

This looks like homework so you need to show us what you know and some code of what you've tried.

Also a better description of the problem you are trying to solve.

My initial thought was you are trying to draw a circle in a checkerboard (8x8 squares) but I think it may be more than that.
 
  • #3
Matlab:
Np   = 400;         % Number of Particles
t    = 10^3;        % Time
M    = zeros(Np,2); % Predefined
Msaf = zeros(Np,2); % Predefined
modi = 0.1;         % Movement modification
r    = 8;           % Radius
rng('shuffle')      % More random

% Circle
cv = linspace(0,2*pi,100);
cx = r*cos(cv);
cy = r*sin(cv);
%axis square
% Circlefor Pic=1:t
  
    Direction=randi([-1,1],Np,2);
    Movement=Direction*modi;
  
    Msaf=M+Movement;
  
   if sqrt(Msaf(:,1).^2+Msaf(:,2).^2)<r
       M=M+Movement;
     
   else
       Msaf=M;
       t=t-1;
 
   end

   plot(cx,cy,'b','Linewidth',2.5)
   %axis equal
   axis([-r r -r r]);
   grid on
   axis square

   hold on
 
   scatter(M(:,1),M(:,2),'r','filled');
 
 
   pause(0.001)
   %drawnow
   hold off

   if t==(100/t)*50
       disp('50%')
   end
   if t==(100/t)*70
       disp('70%')
   end
   if t==(100/t)*90
       disp('90%')
   end
   if t==(100/t)*100
       disp('100%')
   end
end

<<Moderator's note: CODE tags added.>>
 
Last edited by a moderator:
  • #4
Yes I'm trying to draw a circle in a checkerboard (8x8 squares)
 
  • #5
And you need a formula like x^2 + y^2 = r^2 to plot in the 8x8 grid?
 
  • #6
ive figured it out now! Thanks for your help!
 

Related to Make a circle in square that is split 8x8 parts?

1. How do you make a circle in a square that is split into 8x8 parts?

To make a circle in a square that is split into 8x8 parts, you will need to use a compass or a circular object of the desired size to draw a circle within the square. Then, use a ruler to divide the circle into 8 equal parts by drawing lines from the center to the edge at 45 degree angles.

2. What is the purpose of splitting the square into 8x8 parts?

The purpose of splitting the square into 8x8 parts is to create a grid that allows for precise and equal division of the circle. This can be useful in various mathematical and scientific applications, such as creating charts or diagrams.

3. Can the circle be split into a different number of parts?

Yes, the circle can be split into a different number of parts depending on the desired precision and accuracy. The number of parts will also depend on the size of the circle and the tools available for measurement.

4. What is the significance of using a square instead of a different shape?

The use of a square is not necessarily significant, as other shapes can also be divided into equal parts. However, using a square may be more convenient and visually appealing for certain applications.

5. How does this relate to geometry and mathematics?

This task relates to geometry and mathematics because it involves using geometric principles, such as angles and division, to create a precise and symmetrical shape. It also requires measurement and calculation, which are fundamental concepts in mathematics.

Similar threads

Replies
2
Views
7K
Replies
1
Views
11K
Replies
4
Views
1K
Replies
1
Views
3K
Replies
2
Views
3K
Replies
1
Views
1K
Back
Top