How to plot from a specific point?

Hello, I have a rather simple issue that I can't seem to figure out. I have a vector
Vector=[20;50;0];
Which I'd like to plot from this point
Traslacion=[10;-15;10];
Yet I don't know if there's an option for this. Any help would be appreciated

3 Kommentare

Gyan Vaibhav
Gyan Vaibhav am 7 Mär. 2024
As I understand you want to plot a vector between these two points?
Patricio Flores García
Patricio Flores García am 7 Mär. 2024
No, I have a vector from the origin to the point I wish to trace, that being [20; 50 ; 0]
I want to move the origin of the vecotr [10 ; -15 ; 10] and have it respect the original vector's properties
Sam Chak
Sam Chak am 7 Mär. 2024
Hi @Patricio Flores García, Can you sketch on a piece of paper, or use your PC or smartphone to edit the image by drawing the desired vector?

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Voss
Voss am 7 Mär. 2024

0 Stimmen

Vector=[20;50;0];
Traslacion=[10;-15;10];
XYZ = [Vector,Traslacion];
plot3(XYZ(1,:),XYZ(2,:),XYZ(3,:),'r','LineWidth',3)
box on
grid on
view(-31,35)

3 Kommentare

I'm sorry, I think I wasn't very descriptive in my code. But the main issue is that the vector's properties are not respected doing this. As can be seen when I plot from the origin to the vector's "x", "y" and "z" coordinates.
Vector=[20;50;0];
Traslacion=[10;-15;10];
x_original=[0 Vector(1,1)];
y_original=[0 Vector(2,1)];
z_original=[0 Vector(3,1)];
plot3(x_original,y_original,z_original,'LineWidth',2,'Color','k')
grid on
hold on
XYZ = [Vector,Traslacion];
plot3(XYZ(1,:),XYZ(2,:),XYZ(3,:),'r','LineWidth',3)
Patricio Flores García
Patricio Flores García am 7 Mär. 2024
Should I maybe move the axis to the point I want to plot from?
Voss
Voss am 7 Mär. 2024
Bearbeitet: Voss am 7 Mär. 2024
Vector=[20;50;0];
Traslacion=[10;-15;10];
Like this?
figure();
XYZ = Vector+[[0;0;0] Traslacion];
plot3(XYZ(1,:),XYZ(2,:),XYZ(3,:),'r','LineWidth',3)
box on
grid on
view(-31,35)
Or this?
figure();
XYZ = Traslacion+[[0;0;0] Vector];
plot3(XYZ(1,:),XYZ(2,:),XYZ(3,:),'r','LineWidth',3)
box on
grid on
view(-31,35)

Melden Sie sich an, um zu kommentieren.

Fangjun Jiang
Fangjun Jiang am 7 Mär. 2024
Bearbeitet: Fangjun Jiang am 7 Mär. 2024

0 Stimmen

Use line(), you need to put the data in the right format. See help document
Vector=[20;50;0];
Traslacion=[10;-15;10];
d=[Traslacion Vector]
d = 3×2
10 20 -15 50 10 0
line(d(1,:),d(2,:),d(3,:))
view(3);grid on;

2 Kommentare

Hello, sorry, I think I wasn't descriptive enough in my initial question. The main issue is that the original vector's properties (when tracing from the origin to its endpoint) are not respected when trying to displace it:
Vector=[20;50;0];
x_original=[0 Vector(1,1)];
y_original=[0 Vector(2,1)];
z_original=[0 Vector(3,1)];
Traslacion=[10;-15;10];
plot3(x_original,y_original,z_original,'LineWidth',2,'Color','k')
grid on
hold on
d=[Traslacion Vector]
d = 3×2
10 20 -15 50 10 0
line(d(1,:),d(2,:),d(3,:))
Vector=[20;50;0];
Traslacion=[10;-15;10];
d=[zeros(3,1),Traslacion, Vector];
line(d(1,:),d(2,:),d(3,:))
view(3);grid on;

Melden Sie sich an, um zu kommentieren.

Kommentiert:

am 7 Mär. 2024

Community Treasure Hunt

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

Start Hunting!

Translated by