In class today, we will be learning a little bit about Matlab and doing some simple simulations using Matlab. Skim the first four chapters of Allen Downey's book, Physical Modeling in MATLAB, for details about MATLAB. Complete the following exercises: - Downey Exercise 3.1 (p. 14): fibonacci1 script
- Downey Exercise 3.3 (p. 20): car_update script
- Downey Exercise 4.1 (p. 26): car_loop script
- Downey Exercise 4.2 (p. 27): car_loop script with plotting. Also try initial values of a & b = 10000
- Experiment with the following simulation of the trajectory of a hit baseball. For what angle is the horizontal distance maximized?
6. Below is a simple model of a DC motor. Implement this model in MATLAB by making a simulation motor.m similar to the baseball trajectory simulation above. Note that the Greek omega is the angular velocity (in radians/second) and the Greek tau is torque (in Newton-meters). In one time step dt, the rotation changes by omega*dt radians, where there are 2*pi radians in 360 degrees. Also in one time step, omega changes by (tau/m)*dt, where m is the moment of inertia of the motor. V_terminal: 5 Volts7. In a file motor_control_prop.m, develop a proportional control motor controller for the motor model from #6. Introduce a variable K_prop that controls the proportional gain. Design your program so that it runs for several simulated seconds and displays the last time t_last_bad the angle was more than 0.1 degrees away from 90 degrees. Fiddle with K_prop to minimize t_last_bad. What are your values of K_prop and t_last_bad for the least t_last_bad you observe? |

Projects >