Using a newer version of plot (ezplot to fimplicit or fplot)
Afficher commentaires plus anciens
See https://uk.mathworks.com/matlabcentral/answers/327895-how-do-i-plot-a-circular-arc-with-given-two-endpoints-and-radius#answer_272169 for context
Using the answers from this question I was able to edit the code from the link above to get the general arc shape that I wanted.
However, I have a few issues, mainly down to my lack of experience:
1) ezplot isn't recommended for the type of shape, so fplot and fimplicit are suggested as alternatives, and I'm not sure how to change ezplot over and maintain the same arc image
2) I need a functionality to change the thickness of the line which it doesn't currently have
3) With this code it isn't necessary but being able to plot multiple similar arcs on the same graph is also important
I've looked through the help centre for ezplot, fplot and fimplicit and I'm really not sure where I'm going wrong.
Code is pasted below
sparse.vein = [13 28.5 2 90 45 12.1935; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0];
sparse.cross_vein = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
sf1 = 4;
sf2 = -2;
sf3 = 20;
vein1_p1 = [sf1 * sparse.vein(1,1), sf2 * sparse.vein(1,2)]; %point 1
vein1_p2 = [sf1 * sparse.vein(1,4), sf2 * sparse.vein(1,5)]; %point 2
vein1_r = sf3 * [sparse.vein(1,6)]; %radius value
%vein1_t = line thickness
limA = [0 400];
limB = [-200 0]; % [0 400 -200 0]
%first input
a=vein1_p1; %P1
b=vein1_p2; %P2
r=vein1_r; %radius
%next solution
syms x y
[x,y]=solve((x-a(1))^2+(y-a(2))^2==r^2,(x-b(1))^2+(y-b(2))^2==r^2,x,y);
%plot arc
syms X Y
ezplot((X-x(1))^2+(Y-y(1))^2==r^2,[min(52,360),max(52,360), ...
min(-200,0),max(-200,0)])
axis ([0 400 -200 0])
figure
ezplot((X-x(2))^2+(Y-y(2))^2==r^2,[min(52,360),max(52,360), ...
min(-200,0),max(-200,0)])
axis ([0 400 -200 0])
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

