home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / GNUPDEMO.ZIP / controls.demo < prev    next >
Text File  |  1992-03-25  |  784b  |  33 lines

  1. #
  2. # $Id: controls.demo,v 3.26 92/03/24 22:32:19 woo Exp Locker: woo $
  3. #
  4. #
  5. # warning:  this demo is SLOW on PCs without math coprocessors!
  6. #
  7. # From _Automatic_Control_Systems_, fourth ed., figure 6-14
  8. # transient response of a second-order system to a unit step input function
  9. #
  10. damp(t) = exp(-s*wn*t)/sqrt(1.0-s*s)
  11. per(t) = sin(wn*sqrt(1.0-s**2)*t - atan(-sqrt(1.0-s**2)/s))
  12. c(t) = 1-damp(t)*per(t)
  13. #
  14. #    wn is natural undamped frequency
  15. #    s is damping factor
  16. #
  17. wn = 1.0
  18. set xrange [0:13]
  19. set samples 50
  20. set dummy t
  21. #
  22. # plot c(t) for several different damping factors s
  23. #
  24. plot s=.1,c(t),s=.3,c(t),s=.5,c(t),s=.7,c(t),s=.9,c(t),s=1.0,c(t),s=1.5,c(t),s=2.0,c(t)
  25. pause -1 "Hit return to continue"
  26.  
  27. # undo what we have done
  28. set xrange [-10:10]
  29. set autoscale xy
  30. set samples 160
  31. set dummy x
  32.  
  33.