Why not just use C? (Why Python Part 2)

The Case for C

  • you have already been taught C in EGR 106/107
  • we will need C to program the Arduinos for lab
  • C is common for many, many micro-controllers
  • C is well known and there are lots of books on it
  • C can be really fast
  • C programs can be really small

Why Python?

  • ease of use
    • clean syntax
    • dynamic typing
  • interactive program development
    • more on this in a minute
  • power of available libraries
    • numpy, scipy, matplotlib, ipython, python-control, ...

C would be harder than learning Python

  • C is powerful for micro-controllers and can lead to small, fast programs, but it is more difficult to do the modeling and data processing things we will be doing
  • how would you go about reading in a data file, plotting the data, and modeling the response of a system using transfer functions?

Interactive Development

  • try code on the command line
  • inspect all of your variables
  • get help on any function and get helpful error messages
  • copy and paste code from command line to a script file

If you are not convinced...

  • try using C to generate a plot of a sine wave
  • compare how easy or hard that is to doing it in spyder
  • if you do generate a plot without too much pain, try reading in a csv file and plotting that data