Plotting r = r(θ)

In this section:

The following code is extracted from program simdem64.f95 in the Simdem package, and it illustrates how easy it is to plot a curve in the parametric form r = r(θ), where r and theta are double precision arrays.


!
! calculate r = sin(4*theta)
!
      delta = two*pi/dble(n - 1)
      theta(1) = zero
      do i = 2, n - 1
         theta(i) = theta(i - 1) + delta
      enddo
      theta(n) = two*pi
      do i = 1, n
         r(i) = sin(four*theta(i))
      enddo
!
! plot the 8 leaved rose
!
      call rtplot (n, r, theta)

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

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited