I would like to write a code to plot a circle cap like the shape below.
In fact, θ, and a are given and I want to plot it using them. Note: It is not difficult to see that . Also, you can consider the center of the circle .

2 comentarios

Matt J
Matt J el 10 de En. de 2024
Editada: Matt J el 10 de En. de 2024
So, what is the difficulty? Are you coming to this with no Matlab experience? If so, you need the beginner's onramp
Hamed
Hamed el 10 de En. de 2024
Is it easy? I do not know how to hide that part of the circle.

Iniciar sesión para comentar.

 Respuesta aceptada

Matt J
Matt J el 10 de En. de 2024
Editada: Matt J el 10 de En. de 2024
Plotting a section of a circle over a particular angular range is easy. You just have to determine the range you need.
R=2;
t0=40;
t=linspace(-t0,180+t0,1000);
plot(R*cosd(t), R*sind(t)); axis equal; axis padded

3 comentarios

Hamed
Hamed el 10 de En. de 2024
Movida: Dyuman Joshi el 10 de En. de 2024
r = sqrt(2);
theta = pi/3;
t = linspace(-pi + theta, pi - theta, 1000);
x_arc = r * cos(t) - r * cos(-pi + theta);
y_arc = r * sin(t);
figure;
plot(x_arc, y_arc, 'k', 'LineWidth', 2); % 'k' represents black color
axis equal;
axis padded;
title('Circular Arc');
xlabel('X-axis');
ylabel('Y-axis');
grid on;
Hamed
Hamed el 10 de En. de 2024
Thank you! I just modified your code to make it looks better.
Dyuman Joshi
Dyuman Joshi el 10 de En. de 2024
Hello @Hamed, if this answer solved your problem, please consider accepting the answer.
Accepting the answer indicates that your problem has been solved (which can be helpful to other people in future) and it awards the volunteer with reputation points for helping you.
You can accept only 1 answer for a question, but you can vote for as many answers as you want. Voting an answer also provides reputation points.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Performance en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 10 de En. de 2024

Comentada:

el 10 de En. de 2024

Community Treasure Hunt

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

Start Hunting!

Translated by