1 / 59

Solving biological problems with MATLAB Lecturer: Chen Keasar, e-mail: chen@cs.bgu.ac.il

Solving biological problems with MATLAB Lecturer: Chen Keasar, e-mail: chen@cs.bgu.ac.il 08-6477875 Office hours: 37/102 Sunday, 14:00-16:00 Tutors: Mor Ben- Tov (Life Sciences) E-mail: morbentov@gmail.com Office hours: 40/310 Wednesday 15:00-16:00

thane
Download Presentation

Solving biological problems with MATLAB Lecturer: Chen Keasar, e-mail: chen@cs.bgu.ac.il

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Solving biological problems with MATLAB Lecturer: Chen Keasar, e-mail: chen@cs.bgu.ac.il 08-6477875 Office hours: 37/102 Sunday, 14:00-16:00 Tutors: Mor Ben-Tov (Life Sciences) E-mail: morbentov@gmail.com Office hours: 40/310 Wednesday 15:00-16:00 Yonatan Natan (Sde-Boker) E-mail: flyingjony@gmail.com Office hours: Sunday 15:00-16:00 • Web page URL: http://lhttp://moodle.bgu.ac.il/moodle/

  2. What will you learn in the course? • Algorithms • Building blocks for writing a MATLAB program • Using MATLAB for mathematical applications • Handling graphics in MATLAB

  3. The rules of this course • No formal pre-requisite • Math course ( מתמטיקה של מערכות or equivalent) is assumed • lecture notes on web - print and bring • Tutorials – central role in the course • Start in class, complete at home, submit every week (through the web site) • Each student submits own independent work • The use of the Forum of course is allowed, but no code • Missing tutorials (e.g., Miluim), can be exempt but it’s your interest to submit even if later3

  4. The rules of the game (cont.) • • Students from SedeBoqer campus will have tutorial there • • The tutors will instruct you exactly how tom submit tutorial – MUST follow instructions • • Tutorials not submitted accordingly – will not be accepted ! • Final project – selected from a list - or request your own project (no tater than week 5 of the semenster). • • After project submission – an oral exam in front of computer on the project • • Final grade – 35% tutorials, 65% final exam

  5. What do I do with MATLAB?

  6. CLUSTERING

  7. Generation of energy function

  8. What is MATLAB • MATLAB is a language • MATLAB is an interpreter • MATLAB is an integrated environment • MATLAB is a product of MathWorks

  9. What is MATLAB • MATLAB is a language • popSize=23 • is a statement in this language. • It means: • 1. Allocate some space in the computer memory. • 2. Tag this space “popSize”. • 3. Store the number 23 in that space. • MATLAB is an interpreter • MATLAB is an integrated environment

  10. What is MATLAB • MATLAB is a language • popSize=23 • MATLAB is an interpreter • A program that: • 1. reads MATLAB statements • 2. Translates them to machine language • 3. Executes them. • MATLAB is an integrated environment

  11. What is MATLAB • MATLAB is a language • popSize=23 • MATLAB is an interpreter (command window) • >> • popSize = • 23 • MATLAB is an integrated environment popSize=23

  12. What is MATLAB • MATLAB is a language • popSize=23 • MATLAB is an interpreter (command window) • MATLAB is an integrated environment

  13. What is MATLAB • MATLAB is an integrated environment

  14. Programming with MATLAB Basic components in computer program takes input -> operates on it -> gets output Various Input/Output methods – later simplest input: Allocating a value to a variable, e.g.,: a=2 popSize=23

  15. Variable Names • Variables start with a letter • Can continue with more letters, digits etc. • Not longer than 31 characters • Make names easy to remember • make sure no typos • MATLAB is case sensitive • popSizeis different from PopSizeor popSize1

  16. Non-recommended variable names a b1 gc initialpopulationsize

  17. Functions extend the language Specific Syntax: functionoutput=functionName(input) …. the function itself … end Words of MATLAB language

  18. functionoutput=functionName(input) …. the function itself … end Any word you want. Becomes a new word in the language

  19. functionoutput=functionName(input) …. the function itself … end Any word you want. Known only within the function

  20. functionoutput=functionName(input) …. the function itself … end MATLAB code (may include function calls)

  21. Our first function Motivation: populations parthenogenetic aphids

  22. Our first function functionpopSize2 = popDynam(popSize1) birthRate = 0.2 deathRate = 0.1 birth = popSize1 * birthRate death = popSize1 * deathRate change = birth - death popSize2 = popSize1 + change end We will save it in a file popDynam.m

  23. What had happened? The MATLAB interpreter replaced popSize1 by 23 and executed the lines one by one. functionpopSize2 = popDynam(popSize1) birthRate = 0.2 deathRate = 0.1 birth = popSize1* birthRate death = popSize1* deathRate change = birth - death popSize2 = popSize1 + change end 23 23 23 23

  24. This is a bit too verbose

  25. Our first function (fixed) function popSize2 = popDynam(popSize1) birthRate = 0.2; deathRate = 0.1; birth = popSize1 * birthRate; death = popSize1 * deathRate; change = birth – death; popSize2 = popSize1 + change; end Is this the shortest way I could write the function?

  26. The function’s value may be assigned to a variable (actually it is always assigned)

  27. Variables defined in the command window are kept in memory.

  28. You can see them all in the “Workspace” window

More Related