MATLAB Basics 2

From EVOCD
Jump to: navigation, search

Contents

Abstract

This is a quick tutorial for doing the basics in MATLAB.

Author(s): Mark A. Tschopp

For, If, etc

Let's try some looping examples, i.e.,

for i = 1:3
   a(i) = i^2;
end
> a
a = [1 4 9]

or use if, then, else statements

for i = 1:3
   if i == 1
      disp('i = 1')
   elseif i == 2
      disp('i = 2')
   elseif i == 3
      disp('i = 3')
   else
      disp('i > 3')
   end
end


Next Tutorial

Go Back

Personal tools
Namespaces

Variants
Actions
home
Materials
Material Models
Design
Resources
Projects
Education
Toolbox