- 112 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about ' Functions' - stacia

**An Image/Link below is provided (as is) to download presentation**

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

http://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlabhttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab

Reviewhttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab

- Script files
- Run a list of commands

- Flow Control
- If, for, while, etc

Functionshttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab

- All variables are local variables

Examplehttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab

Fibonacci Sequencehttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab

- Write a function that calculates the nth number in the Fibonacci Sequence

My solutionhttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab

orhttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab

orhttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab

orhttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab

Multiple inputs and outputshttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab

- Comments + good layout make things easier to read, correct, use and re-use.

Solving Equationshttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab

- Write a function that solves
- For real roots, otherwise displays an error.
- Also creates a plot of this function.
- And displays the real roots.

My Solutionhttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab

What is the difference between a script and a m-file?http://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab

Pendulum Simulationhttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab

- Inputs:http://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab
- Length of pendulum
- Starting pendulum angle

- Hints:
- To start just draw the pendulum in its starting position
- Use Euler rule

Download Presentation

Connecting to Server..