Silverfrost Logo About Us | Contact Us
 

Plotting x = x(t), y = y(t), z = z(t)

The following code was extracted from simdem23 in the Simdem package, in order to demonstrate how easy it is to plot parametric curves in space, where x, y and z are double precision arrays. Of course, x, y, and z do not have to be defined parametrically and any sets of x,y,z triples can be plotted.


c
c Define t
c
      n = nmax/2
      t(1) = zero
      t(n) = two*pi
      delta = (t(n) - t(1))/(dble(n) - one)
      do i = 2, n - 1
         t(i) = t(i - 1) + delta
      enddo
c
c Define x, y, z as a helix
c
      x(1) = one
      y(1) = zero
      z(1) = one
      do i = 2, n - 1
         delta = two*t(i)
         x(i) = cos(delta)
         y(i) = sin(delta)
         z(i) = dble(i)
      enddo
      x(n) = x(1)
      y(n) = y(1)
      z(n) = dble(n)
c
c Display the space curve
c
      call space0 (n, nmax,
     +             x, xtemp, y, ytemp, z)
      

The following plot is then displayed and can be edited to add further features, printed, or archived as a graphics file.

 

 

Copyright © 1999-2017 Silverfrost Limited