fcan.fun 804 B

123456789101112131415161718192021222324252627282930313233
  1. #import std
  2. #import nat
  3. #import flo
  4. #import rlc
  5. #import tbl
  6. (# quick throwaway program to make a table of voltages and currents
  7. through all components of an RLC circuit read from a binary file
  8. named circ at compile time #)
  9. #binary+
  10. freqs = <0.1,1.>
  11. data = ~&hnSPmSSK7p (gang current_division* 1+0j-* freqs) circ
  12. title = 'componentwise analysis at two frequencies'
  13. content = format/freqs data
  14. #binary-
  15. format = # takes frequencies and data to headings and columns
  16. ^|(
  17. :/<''>^:0+ * -+
  18. \/~&V ^:(~&iNCNVS <'amplitude','phase'>)* ~&iNCS <
  19. 'current (mA)',
  20. 'voltage drop (mV)'>,
  21. ~&iNC+ '$\omega = '--+ --'$ rad/s'+ printf/'%0.1f'+-,
  22. :^/~&nS ~&mS; ~&K7+ *=* --+ phaser;$ ^|lrNCC\~& times/1.e3)
  23. #output dot'tex' label'can'+ elongation title
  24. can = table2 content