Looking to plot a function in 3D
3 views (last 30 days)
Show older comments
I have a function type1 which returns to me an output in the form of a 3x1 matrix for an input t
X=[x y z]
The components of X, (x,y,z) are for a point in 3d space.
I'm looking to plot all the possible X values on one figure for 0<t<360.
I've tried looking at the surf and mesh function, not quite sure how to get it to work.
plot3(X(1),X(2),X(3),'.');
grid on
The above presents just one point in 3d space.
function [ X ] = type1b(t)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
%Definition of variables (most will be variable)
qr1=[0,0,1]; %Axis of rotation of link 1 (v)
qr2=[0,0,1]; %Axis of rotation of link 2 (v)
H1=[1,0,0]; % Link 1 (v?)
H2=[1,0,0]; % Link 2 (v?)
; %Angle of rotation
U1=[cos(t/2),sin(t/2)*qr1]; %quaternion rotor for link 1
U2=[cos(t/2),sin(t/2)*qr2]; %quaternion rotor for link 2
Ug=U1; %Globalising Quaternion (v)
H2g=quatrotate(Ug,H2); %Globalised H2
X=quatrotate(U1,H1)+ quatrotate(U2,H2g); %+d;
plot3(X(1),X(2),X(3),'.');
grid on
0 Comments
Answers (1)
Image Analyst
on 27 Dec 2013
What about
plot3(x, y, z, '.');
??? You said you had x, y, and z - that's how you constructed X, right? So just plot them.
3 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!