BMES 505 Lecture Notes - Lecture 3: Infinite Loop, Spreadsheet, Matlab

32 views3 pages

Document Summary

Programming: for loops for indexer = expression end. Used to repeat calculations for a specific # of times or iterations. Element by element matrix calculation for loop: plug each value or quantity into voltage vector. Voltage = 1:0. 001:20; for n=1:length(voltage) pressure(n) = 3*voltage(n)^3+5*voltage(n)^-1/voltage(n)^2; end plot(voltage,pressure) if-else (conditional statements) if logical expression. Similar to a for loop, the difference being that you decide the number of iterations. While loops have a higher chance of an infinite loop if code is written incorrectly or if mistakes were present. Spreadsheet has measurement of blood cell size in a sample of blood (cell width) We want to know how many red blood cells, platelets and leukocytes were present in the sample. Need to scan through the spreadsheet, examine each measurement, determine the cell type and report the results. Need to write a matlab code to display the findings. Countunknown; for n=1:length(cells) % scans each measurement value if cells(n)<=6 && cells(n)<=8.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents