Creating a shape with varying arcs?
显示 更早的评论
I would like to create a circle-like shape, but with various arcs along the circumference. A better way to explain this is just explain an example.
For example, I want to start with a circle that has a radius of 2 inches, have it gradually grow out to 3 inches over "x" radians, stay at 3 inches for "y" radians, and then return to 2 inches over "z" radians. Is this possible to plot in MATLAB? I am not sure how I would go about getting equations for those arcs and putting them together in a piecewise fashion to display continuously. The center of this circle is irrelevant to the problem, so for simplicity I will say the center of the BASE circle (the 2 in circular arc) is the origin. Picture for reference:

采纳的回答
更多回答(1 个)
Giorgos Papakonstantinou
2015-3-6
If I understood correctly you mean a spiral. Here's one way then:
turns=5;
theta = 0:pi/180:2*pi*turns;
r = 2*ones(size(theta));
r(theta>1 & theta<=4) = linspace(2, 3, sum(theta>1 & theta<=4)); % radius gradually grows from 1<theta<=4 rad
r(theta>4) = 3; % constant radius for 4 rad<theta<=6 rad
r(theta>6) = linspace(3, 20, sum(theta>6)); % radius gradually grows from 6 rad<theta
X=sin(theta).*r;
Y=cos(theta).*r;
plot(X,Y)
axis square
Of course you can adjust the radians as you wish.

类别
在 帮助中心 和 File Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



