From the course: MATLAB 2018 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Use vectors and matrices in a function

Use vectors and matrices in a function - MATLAB Tutorial

From the course: MATLAB 2018 Essential Training

Start my 1-month free trial

Use vectors and matrices in a function

- [Instructor] Matrices and vectors can contain many types of values. In this movie, I will assume they contain meaningful numbers such as measurements from your business operation or experiments. Using these values, we can calculate minimums, maximums, running totals, and other characteristics. I have a blank command window in MATLAB, so I need to start by creating some data. I'll start with a vector, and I'll just call it vec1, then an equal sign for assignment, and I'll do a range, so I'll type a left square bracket and then the number three, a colon, the number six, colon, and 33. So what I want are the numbers from three to 33, going up in increments of six, so three, nine, 15, 21, and so on. Type a right square bracket to close the definition, enter, and I get my values. The min function will return the smallest or minimum value from a vector. So if I type min, M-I-N, and then vec1, the name of my variable, right parentheses and enter, that I get the answer of three which is…

Contents