class_notes14

class_notes14 - contents index search demos From the...

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

View Full Document Right Arrow Icon
Engineering 3 – Class 14 Today: •MatLabintro! • environment walk-around • comparison with C
Background image of page 1

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

View Full DocumentRight Arrow Icon
onward to MatLab… • Compiled vs. Interpreted languages • Comparison -find sin(x) for in steps of 0.1 -plot? π 2 0 x
Background image of page 2
Desktop Environment • command window • workspace • current directory • command history • toolbar Matlab
Background image of page 3

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

View Full DocumentRight Arrow Icon
A certain cylindrical tank is 15 m tall and has a radius of 8 m. Design another cylindrical tank with a volume 20 percent greater but having the same height. Example h V r π = h r V 2 =
Background image of page 4
Arrays • arrays are one the of main strengths of MatLab • to create an array, simply: >> x = [0, 1, 3, 6]; • if values are regularly spaced: >> x = [0:0.1:10]; • addition, subtraction, length() • can be used with any built in function
Background image of page 5

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

View Full DocumentRight Arrow Icon
Plotting • straightforward plot generation is another strength of MatLab • to create a plot, >> plot(x,y); where x values are on horizontal axis, and y values on vertical • if values are regularly spaced: >> x = [0:0.1:10]; • addition, subtraction, length()
Background image of page 6
HELP! • Matlab has excellent built-in documentation.
Background image of page 7

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

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

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

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

Unformatted text preview: contents index search demos From the command prompt: >>help function_name >>doc function_name Script Files Matlab can be run interactively, or commands can be saved in a script file (also called an m file ) running an m-file is equivalent to typing commands, one at a time, at the Command window prompt create in a couple of different ways: >>edit file_name.m File/New or Toolbar button for comments, use % Input and Output to get input from user, use input() function: >> n = input(Enter value:) for output, use either disp() or fprintf() function >>disp(value is: ); >>disp(n); or >>fprintf(value is %d\n, n); Note that single quotes are being used instead of double quotes Repetition and Decision Making introduction, plot the function: for -5<=x<=30 + + = 10 10 10 10 4 15 x x y 9 9 x x x...
View Full Document

Page1 / 10

class_notes14 - contents index search demos From the...

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

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