How to plot Vector in 3d using two angles and initial point
Mostra commenti meno recenti
Hi! Could you please help me
How to put 3d vector if i know initial point coordinates and two angles
I tries this one, but still could not understand where is my phi and theta on 3d according to matlab plotting
x0=1.5; %initial x position
y0=1.5; %initial y position
z0=3.0;
r = sqrt(x0^2 + y0^2 + z0^2);
x1 = r * sin(Phi0) * cos(Theta0);
y1 = r * sin(Phi0) * sin(Theta0);
z1 = r * cos(Phi0);
line([x0 x1],[y0,y1],[z0,z1]);
xlabel X; ylabel Y; zlabel Z
grid on;
axis equal
%I also have tried this one
%x1 =r * sind(theta) * cosd(phi); % !!!convert to cart mine last one
%y1 = r* sind(theta) * sind(phi);
%z1 = r* cosd(theta);
Here his how my angles should be

Risposta accettata
Più risposte (1)
Walter Roberson
il 13 Dic 2022
0 voti
You have initial coordinates, and you calculate radius based on those coordinates. That is equivalent to saying that the initial point is on the surface of the sphere around the origin.
Then you calculate coordinates based on that radius and two angles. That is like asking "what point at the same radius as the initial point, is at this particular angle on that implied sphere?"
That is a valid thing to calculate, but is that what you want to calculate?
I suspect that what you are looking for is to find a vector at a particular spatial angle, that goes through the given point, and to sketch a segment of that vector,
1 Commento
Aknur
il 13 Dic 2022
Categorie
Scopri di più su Data Type Identification in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



