Disk out of an arc

1 view (last 30 days)
Minas Emiris
Minas Emiris on 11 Apr 2018
Commented: Minas Emiris on 14 Apr 2018
I was wondering how to create a matrix of points inside an arc of a specific radius R. My goal is my matrix to have a sufficient number of elements, so that when creating a 2D/3D plot, the shape appear as a surface. My idea is to create a set of many arcs, so that the shape appears as continuous. I used a fairly easy code to create arcs of angle pi/8:
R = 0;
theta = pi/8;
x = linspace(R*cos(theta),R,100);
y = sqrt (R^2 - x.*x);
plot(x,y)
xlim([0 5])
ylim([0 5])
hold on
R = 1;
x = linspace(R*cos(theta),R,100);
y = sqrt (R^2 - x.*x);
plot(x,y)
hold on
R = 2;
x = linspace(R*cos(theta),R,100);
y = sqrt (R^2 - x.*x);
plot(x,y)
hold on
R = 3;
x = linspace(R*cos(theta),R,100);
y = sqrt (R^2 - x.*x);
plot(x,y)
hold on
R = 4;
x = linspace(R*cos(theta),R,100);
y = sqrt (R^2 - x.*x);
plot(x,y)
hold on
R = 5;
x = linspace(R*cos(theta),R,100);
y = sqrt (R^2 - x.*x);
plot(x,y)
hold on
How can I continue a similar procedure with a function that avoids writing so many values of R manually? I thought using R = linspace (0,Rmax,N), where Rmax is the radius of the disk, N the number of arcs, but his doesn't appear to work; there is an error with the functions I am using.
  2 Comments
Minas Emiris
Minas Emiris on 11 Apr 2018
Let me start by specifying the purpose I need this 2D sketch for. I recognise 3d sketching is easier with Autocad, but I wanted to create a 3D sketch of a wheel's rim. For the front part which I will attach on a photo below, the way I thought I could create it was firstly to create a 2D sketch of the surface, then create a 3D. For this surface, I figure it will be easier to split it in small parts which repeat in a circular pattern as shown (16 times).
Now, to create the plot I figured I could firstly create a matrix of points inside the arc, then delete the points of the matrix which lie below the curve formed by the holes of the rim (shown as curve C1). This is the reason why I think the function surface might not work.
Moving onto my attempt, I am attempting to use the function of linspace to create a set of radii (R = linspace(0,5,100) for example), but I am using linspace for x as well in terms of R, so the error message is that the input of linspace must be scalar.

Sign in to comment.

Accepted Answer

Are Mjaavatten
Are Mjaavatten on 11 Apr 2018
Edited: Are Mjaavatten on 11 Apr 2018
Is this what you want?
R = 5;
x = linspace(R*cos(theta),R,100);
y = sqrt (R^2 - x.*x);
x = [0,x];
y = [0,y];
patch(x,y,'b')
Alternatively, by plotting one arc at a time, as you proposed:
figure;
hold on
N = 300;
Rmax = 5;
R = linspace (0,Rmax,N);
for i = 1:N
x = linspace(R(i)*cos(theta),R(i),100);
y = sqrt (R(i)^2 - x.*x);
plot(x,y,'b');
end
  6 Comments
Minas Emiris
Minas Emiris on 14 Apr 2018
Thank you very much!! Nice poem!

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!