## First Step

Due in stages.
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

### First Step

Due at the beginning of class on Friday, November 3, 2017. No extensions and strict deadline. The Miata didn't get to where it is today by its engineers being late. If you can't get to class before it starts, have a trustworthy friend submit your report.

Write a Matlab program that computes the height of the car as it drives down the road.

You may use ode45() as long as you do something to validate the answers you get.

• Plot the height of the car and the height of the road along the length of the road.
• Allow you to change the velocity of driving. You may assume the velocity is constant along the 1 km road, but need to be able to check how the car rides at different velocities for different "runs" along the road. In other words, have a "v" variable.
• Allow you to change k and b, but for this first step you will just use the baseline values.
You must submit a one page, one side only, report that presents evidence that is concisely convincing that your program is correct. Based upon this, your boss will decide whether to invest the time and money needed to continue the project. You must be ready to promptly submit a well-documented program if your boss requires it.

If you use ode45() in Matlab, it needs a function that gives the right hand side of the differential equation. For some reason, it really, really wants that function to be a function of x and t only. But in order for us to compute y and dydt we need to send it other variables too, like wavenos, phi and sk0. The way to deal with this is with an anonymous function. If my right hand side function is called carrhs.m then use the following syntax in ode45():

Code: Select all

``[t z] = ode45(@(t,z) carrhs(t,z,sk0,wavenos,phi,v,m,b,k),[0 timetodrive1km], [icz iczdot])``
The whole part

Code: Select all

``@(t,x) carrhs(t,x,sk0,wavenos,phi,v,m,b,k)``
is the anonymous function. Without the very first part in front of carrhs it won't work. You should think of the whole part as like "@ex1rhs" like we've done in class a lot of times.
Bill Goodwine, 376 Fitzpatrick
emcandre

### Re: First Step

Professor Goodwine,

Do we need to attach our code when submitting this first step? Or just the single page report and plot?
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

### Re: First Step

emcandre wrote: Wed Nov 01, 2017 10:24 pm Professor Goodwine,

Do we need to attach our code when submitting this first step? Or just the single page report and plot?
"You must be ready to promptly submit a well-documented program if your boss requires it."
Bill Goodwine, 376 Fitzpatrick