필터 지우기
필터 지우기

Drawing an arc on the end of a straight line

조회 수: 2 (최근 30일)
Chris cjsholmes@hotmail.com
Chris cjsholmes@hotmail.com 2015년 5월 9일
댓글: Star Strider 2020년 4월 25일
I am trying to find out a way to plot an arc on the end of a line in Matlab.
For instance:
I have an array that runs from -1 to +1, and I wish for the central section (-0.7:0.7) to be 0, and then at each side a quarter circle of radius 0.3 going up into the +y direction. (See image if my poor description of the geometry is doing no good).
I cannot figure out the equation of a line to do the curves, and I can't seem to translate anything on the internet to this problem, where I need to find the equation of that line as a function of x, where the x-axis runs from 1:20, and each curve section is from 1:30 and 70:200 respectively.
Any help is much appreciated, I'm sure this can't be that hard, but I'm out of ideas.

답변 (1개)

Star Strider
Star Strider 2015년 5월 9일
Recalling basic geometry, for an angle vector going from 0 to 2*pi, the equation for a complete circle with radius ‘r’ is given as:
angle = linspace(0,2*pi);
r = 1;
x = r*cos(angle);
y = r*sin(angle);
figure(1)
plot(x, y)
grid
axis equal
You can translate the circle (move its centre) by adding appropriate values to the ‘x’ and ‘y’ vectors, and changing its radius involves changing the value assigned to ‘r’. So to move it to be centred at (3,5), add 3 to ‘x’ and 5 to ‘y’. Plotting only a segment of the circle requires you to change the first and second arguments to the linspace call.
Experiment with it! You’ll have your finished plot in a few minutes.
  댓글 수: 9
Moby Philip
Moby Philip 2020년 4월 25일
Hello @Star Strider can you please elaborate why you choose R4crc = linspace(-pi/2, 0, 30); as from -90. It should be 0 right because you are in X-Axis.
Star Strider
Star Strider 2020년 4월 25일
I chose it because it works in this instance.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by