How to name point on plot?

149 vues (au cours des 30 derniers jours)
Federico MegaMan
Federico MegaMan le 2 Déc 2019
Hello, I have to plot some points in a graphic. I know that I can mark the points with 'o' or with 'x', but can I rename the points that I plot? For example A1, A2 ecc.
This is my program and how I plot my points.
clear all
close all
clc
a1=1;
b1=1;
a2=2;
b2=0.5;
a3=3;
b3=1.5;
a4=2;
b4=2;
p0=2.1;
q0=0.6;
r0=1.5;
p1=2;
q1=2;
sol(:) = fsolve(@(x)funzmia6(x), 1:8);
s0=sol(1);
r1=sol(2);
s1=sol(3);
vxp0=[p0,p1];
vyq0=[q0,q1];
vxr0=[r0,r1];
vys0=[s0,s1];
vxpr=[p1,r1];
vyqs=[q1,s1];
vx00=[p0,r0];
vy00=[q0,s0];
figure;
hold on
plot(p0,q0,'o')
plot(p1,q1,'o')
plot(r0,s0,'o')
plot(r1,s1,'o')
plot(vxp0,vyq0)
plot(vxr0,vys0)
plot(vxpr,vyqs)
plot(vx00,vy00)
plot(a1,b1,'x')
plot(a2,b2,'x')
plot(a3,b3,'x')
plot(a4,b4,'x')
grid on
function F=funzmia6(x)
s0=x(1);
r1=x(2);
s1=x(3);
theta12=x(4);
theta13=x(5);
theta14=x(6);
L2=x(7);
L4=x(8);
a1=1;
b1=1;
a2=2;
b2=0.5;
a3=3;
b3=1.5;
a4=2;
b4=2;
p0=2.1;
q0=0.6;
r0=1.5;
p1=2.184;
q1=2.184;
F(1)=p1*p0+q1*q0-a2*p0-b2*q0-a1*p1-b1*q1+(a1^2+b1^2+a2^2+b2^2)/2+cos(theta12)*(-p0*p1-q0*q1+a1*p0+b1*q0-a1*a2-b1*b2+a2*p1+b2*q1)+sin(theta12)*(p1*q1-q0*p1-b1*p0+a1*q0+a2*b1-a1*b2+b2*p1-a2*q1);
F(2)=p1*p0+q1*q0-a3*p0-b3*q0-a1*p1-b1*q1+(a1^2+b1^2+a3^2+b3^2)/2+cos(theta13)*(-p0*p1-q0*q1+a1*p0+b1*q0-a1*a3-b1*b3+a3*p1+b3*q1)+sin(theta13)*(p1*q1-q0*p1-b1*p0+a1*q0+a3*b1-a1*b3+b3*p1-a3*q1);
F(3)=p1*p0+q1*q0-a4*p0-b4*q0-a1*p1-b1*q1+(a1^2+b1^2+a4^2+b4^2)/2+cos(theta14)*(-p0*p1-q0*q1+a1*p0+b1*q0-a1*a4-b1*b4+a4*p1+b4*q1)+sin(theta14)*(p1*q1-q0*p1-b1*p0+a1*q0+a4*b1-a1*b4+b4*p1-a4*q1);
F(4)=r1*r0+s1*s0-a2*r0-b2*s0-a1*r1-b1*s1+(a1^2+b1^2+a2^2+b2^2)/2+cos(theta12)*(-r0*r1-s0*s1+a1*r0+b1*s0-a1*a2-b1*b2+a2*r1+b2*s1)+sin(theta12)*(r1*s1-s0*r1-b1*r0+a1*s0+a2*b1-a1*b2+b2*r1-a2*s1);
F(5)=r1*r0+s1*s0-a3*r0-b3*s0-a1*r1-b1*s1+(a1^2+b1^2+a3^2+b3^2)/2+cos(theta13)*(-r0*r1-s0*s1+a1*r0+b1*s0-a1*a3-b1*b3+a3*r1+b3*s1)+sin(theta13)*(r1*s1-s0*r1-b1*r0+a1*s0+a3*b1-a1*b3+b3*r1-a3*s1);
F(6)=r1*r0+s1*s0-a4*r0-b4*s0-a1*r1-b1*s1+(a1^2+b1^2+a4^2+b4^2)/2+cos(theta14)*(-r0*r1-s0*s1+a1*r0+b1*s0-a1*a4-b1*b4+a4*r1+b4*s1)+sin(theta14)*(r1*s1-s0*r1-b1*r0+a1*s0+a4*b1-a1*b4+b4*r1-a4*s1);
F(7)=(p1-p0)^2+(q1-q0)^2 -L2^2;
F(8)=(r1-r0)^2+(s1-s0)^2 -L4^2;
end

Réponse acceptée

KALYAN ACHARJYA
KALYAN ACHARJYA le 2 Déc 2019
Modifié(e) : KALYAN ACHARJYA le 2 Déc 2019
text(x,y,txt)
x,y represent the data point, see detail here
  1 commentaire
Federico MegaMan
Federico MegaMan le 2 Déc 2019
Perfect, I resolve it. Thank you very much.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by