home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume10 / complex-lib / cxphsr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-07-14  |  395 b   |  26 lines

  1. /*
  2.     CxPhsr -- construct a complex "phasor" from amplitude and phase
  3.  
  4.     CxPhsr( &c, amp, phs )    makes  c = amp exp(i phs)
  5.                     and returns  &c
  6.  
  7.     last edit:    86/01/04    D A Gwyn
  8.  
  9.     SCCS ID:    @(#)cxphsr.c    1.1
  10. */
  11.  
  12. #include    <math.h>
  13.  
  14. #include    <complex.h>
  15.  
  16. complex *
  17. CxPhsr( cp, amp, phs )
  18.     register complex    *cp;
  19.     double            amp, phs;
  20.     {
  21.     cp->re = amp * cos( phs );
  22.     cp->im = amp * sin( phs );
  23.  
  24.     return cp;
  25.     }
  26.