Post Reply 
Plotting curve f(x,y,z) with HP Prime
11-15-2014, 06:46 PM
Post: #1
Plotting curve f(x,y,z) with HP Prime
Does anyone know is there a way to plot a curve in 3-space with the HP Prime? For example, plot the circular helix defined by the parameterized vector r(t)=[a*sin(t), a*cos(t), c*t].
Find all posts by this user
Quote this message in a reply
11-20-2014, 07:14 AM
Post: #2
RE: Plotting curve f(x,y,z) with HP Prime
You can use the parametric app, but you'll have to transform the 3 dimensions down to 2. You do this through the use of rotation matrices - rotate about x, rotate about y, rotate about z (see wiki discussing 3D rotations for instance).

For example, if you rotate about x by -45 degrees, then rotate about z by 30 degrees, your rotation matrix is [[0.7071068, 0.3535534, -0.6123724], [0, 0.8660254, 0.5], [0.7071068, -0.3535534, 0.6123724]]. Your input vector is [a*sin(T), a*cos(T), c*T]. So you'd left multiply your rotation matrix with your input vector, then decide which two components to view.

Suppose you wanted to plot the new x and y projection. Then in the Parametric Symbolic View you'd enter X1(T) = 0.7071*A*SIN(T)+0.3536*A*COS(T)-0.6124*C*T and for Y1(T) = 0.8660*A*COS(T)+0.5*C*T. See screen shots.
       
Probably you're going to want a program where you enter the yaw, pitch, and roll angles and the function you want to plot, and the program does the rotation and configures X1(T) and Y1(T) for you.
Find all posts by this user
Quote this message in a reply
11-20-2014, 07:59 AM (This post was last modified: 11-20-2014 08:17 AM by Han.)
Post: #3
RE: Plotting curve f(x,y,z) with HP Prime
Here's some code you can modify:

Code:
#cas
PPLOT(a,c,t0,tn,dt):=
BEGIN
  local n:=1,l;
  r(t):=[a*cos(t),a*sin(t),c*t];
  ptdef:=MAKELIST(r(X),X,t0,tn,dt);
  n:=size(ptdef)-1;
  ldef:=MAKELIST({X,X+1},X,1,n);
  l:=LINE_P(ptdef,ldef,
    {
      [[1,0,0,0],[0,1,0,0],[0,0,1,15]], 
      "N",
      {-160,-120,16*15},
      {-a,a,-a,a,c*t0,c*tn} 
    });
  freeze;
  return 0;
END;
#end

The matrix in the code is a 3x4 matrix used for perspective projection. The first three columns correspond to the 3x3 matrix resulting form the product of the three rotation matrices (about each axis). The last column is simply the eyepoint vector <0,0,d>. You'll need to adjust the 15 so that the distance d is larger than the distance from the center of the viewing box to the corner farthest from the center of the viewing box (similarly for the 16*15 value).

Edit: If you need help writing your own program, just post on the forums here and I'm sure someone will help. I've been thinking about creating a 3D parametric plot app but am already buried deep in other projects (also 3D related).

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
05-25-2018, 11:51 PM (This post was last modified: 05-25-2018 11:52 PM by MagicMachine2.)
Post: #4
RE: Plotting curve f(x,y,z) with HP Prime
Hi Han,

Copied your program on my Prime but it won't work. There's no error but when I tried to run PPLOT, it won't run but there's a exclamation point (!) displayed on the screen.

Hope you can help me.

Thank you.

Regards,
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)