Functions

Publish in

Documents

4 views

Please download to get full document.

View again

of 16
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Share
Description
Functions. http://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlab. Review. Script files Run a list of commands Flow Control If, for, while, etc. Functions. All variables are local variables. Example. Fibonacci Sequence.
Transcript
Functionshttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlabhttp://www2.warwick.ac.uk/fac/sci/moac/degrees/modules/tutorial/matlabReview
  • Script files
  • Run a list of commands
  • Flow Control
  • If, for, while, etc
  • Functions
  • All variables are local variables
  • ExampleFibonacci Sequence
  • Write a function that calculates the nth number in the Fibonacci Sequence
  • My solutionorororMultiple inputs and outputs
  • Comments + good layout make things easier to read, correct, use and re-use.
  • Solving Equations
  • 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 SolutionWhat is the difference between a script and a m-file?Pendulum SimulationInputs:
  • Length of pendulum
  • Starting pendulum angle
  • Hints:
  • To start just draw the pendulum in its starting position
  • Use Euler rule
  • Related Search
    We Need Your Support
    Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

    Thanks to everyone for your continued support.

    No, Thanks