Lecture 1-28

Lecture 1-28 - adds a tab o%e scientific notation(with...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Input Numerical Input Distance = input (‘How far? (in inches ‘) Text input typed by user DataMonth = input (‘What month?’,’s’) - Place semicolon at end to suppress it - Input can be used with -> Arrays and Matrices Menu Function Input selected by the user from a menu generated by programmer - NumEquations = menu(‘Number of Equations’,1,2,3,4,5) Output - Disp(x) just dumps the value of text to screen  useless except for debugging - fprintf statements to copy to  Matlab for demsontration - fprintf(‘/nIf the variable x is defined, the value is %4.3f./n/n’,x) - fprintf(‘/nFurthre, if x and y are defined, x is %4.2f and y is %4.2./n/n’.x,y) o Displayed in Appendix c o %4   4 values before decimal, .2   2 values after decimal o Use %d for integers o \n   go to new line o %s    for a string o \t 
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: adds a tab o %e scientific notation (with lower case e) o %E scientific notation (with upper case E) On Screen Documentation Problem statems using fprintf help (%-block) Plot plot – page 25 in Palm Examples: X = [0:0.02:0]; Y = 5*sin(x); plot(x,y); A = [10 20 30 35 40]; B = [2 2.5 3 3.5 4.5]; plot(A,B);-plot will check to see if x and y have the same dimensions-figure creates a new figure so more than one plot can be displayed FPlot – page 266 in Palm Examples: fplot(‘cos(x)’,[0:2*pi]) Proper Plots with Matlab-Line types: Sybols, Colors- page 273-Plot(x,y,’o’,A,B,’x’)-Grid displays a grid for the plot-xlabel (‘____’) labels x axis-ylabel “ “-title(‘My Graph Title’)-legend(‘5sin(x)’,’experimental data’) Before Lab-Review Unit 1 and 3...
View Full Document

Page1 / 2

Lecture 1-28 - adds a tab o%e scientific notation(with...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online