p1 as a star, you can use the 'Marker' property with the value '*'. To create a legend only for the first point, you can provide a label to the 'DisplayName' property. Here's the updated code:
p1 = [6 3 0]';
p2 = [3 5 0]';
p3 = [1 7 0]';
p4 = [1 -1 0]';
x = [];
y = [];
z = [];
x(1) = p1(1), y(1) = p1(2), z(1) = p1(3);
x(2) = p2(1), y(2) = p2(2), z(2) = p2(3);
x(3) = p3(1), y(3) = p3(2), z(3) = p3(3);
x(4) = p4(1), y(4) = p4(2), z(4) = p4(3);
figure
% Plot the first point with a star marker
p1 = plot3(x(1), y(1), z(1), 'r*', 'MarkerFaceColor', 'b', 'DisplayName', 'p1');
hold on
% Plot the remaining points with a diamond marker
p_rest = plot3(x(2:end), y(2:end), z(2:end), 'rd', 'MarkerFaceColor', 'b');
grid on
xlim([-5 10])
ylim([-5 10])
zlim([-5 10])
xlabel('X Axis'), ylabel('Y Axis'), zlabel('Z Axis');
% Create a legend only for the first point
legend(p1);
This code will plot the first point (p1) with a star marker and the other points with a diamond marker. The legend will only display the label for p1.
Important: There may be some mistakes in this answer Experts can tell if there are any mistakes and you might find better answer
Give me your feedback
Thanks