Looking to plot a function in 3D
Ältere Kommentare anzeigen
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
Antworten (1)
Image Analyst
am 27 Dez. 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 Kommentare
Image Analyst
am 27 Dez. 2013
Bearbeitet: Image Analyst
am 27 Dez. 2013
for t = 0:360 % Get all values of x, y, and z.
[x(t), y(t), z(t)] = type1();
end
plot(x, y, z, '.');
Sam
am 27 Dez. 2013
Image Analyst
am 27 Dez. 2013
How did you call it? What is the value of "t"?
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!