Draw arc in Matlab?
242 次查看(过去 30 天)
显示 更早的评论
In Matlab is there any special function to draw arc with user defined radius, points and angle. If it is not there how is it possible to draw a curve in a figure using user defined radius,angles, points etc. Thank you
0 个评论
采纳的回答
Star Strider
2016-3-27
There are no such functions in core MATLAB, but they’re easy enough to write.
This code plots an arc of stars:
circr = @(radius,rad_ang) [radius*cos(rad_ang); radius*sin(rad_ang)]; % Circle Function For Angles In Radians
circd = @(radius,deg_ang) [radius*cosd(deg_ang); radius*sind(deg_ang)]; % Circle Function For Angles In Degrees
N = 25; % Number Of Points In Complete Circle
r_angl = linspace(pi/4, 3*pi/4, N); % Angle Defining Arc Segment (radians)
radius = 1.5; % Arc Radius
xy_r = circr(radius,r_angl); % Matrix (2xN) Of (x,y) Coordinates
figure(1)
plot(xy_r(1,:), xy_r(2,:), 'bp') % Draw An Arc Of Blue Stars
axis([-1.25*radius 1.25*radius 0 1.25*radius]) % Set Axis Limits
axis equal % No Distortion With ‘axis equal’
9 个评论
Audrey Fernandes
2020-7-16
How can this arc be repeated into a series of arcs? Like the one this the image below?
Matheus Sousa
2021-3-26
Adding the center points of each circle to xy_r should do it, in the example abova nothing was added so the center is in [0,0], but if you add 3 on xy_r(1,:) and 0 to xy_r(2,:) the position of the arc will change as well.
更多回答(2 个)
Ade Ade
2019-7-9
%Equation of a circle with centre (a,b) is (x-a)^2+ (y-b)^2 = r^2
%Circle Centre (1,1), radius = 10
k=1; %counter
c =1 ; % value of x at the centre of the circle
while c <=11
x(k) = c ;
vv = (c-1)^2 ;
y (k) = 1 + real (sqrt (100 - vv) );
c= c + 0.02;
k=k+1;
end
plot (x, y, 'r')
axis equal
0 个评论
Sudhir S
2022-4-28
Hello everyone, I'm currently working on a project that requires MATLAB code. This is a 2D blade profile which was design using CATIA V5. I was able to code up till this point, but I got stuck on the arc creation. The radius of the arc is given, and the beginning point is fixed for that arc. The inlet angle is used to determine the finishing point. Could someone assist me in locating a solution?
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!