12.07.2015 Views

II.1 Programming in MATLAB Getting Started Graphing

II.1 Programming in MATLAB Getting Started Graphing

II.1 Programming in MATLAB Getting Started Graphing

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

To try out a few other vector operations, type <strong>in</strong>cleara = [1, 2, 3]b = [2, 3, 4]and then type <strong>in</strong> each of the follow<strong>in</strong>g quantities and hit enter:a*b’ a’*b dot(a,b)dot(a,b’) cross(a,b) cross(a’,b’)Notice that the dot function does not dist<strong>in</strong>guish betweencolumn vectors and row vectors but that the other operationsdo.FunctionsThe third and f<strong>in</strong>al template shows you how to createfunctions. This will help you become more efficient <strong>in</strong>programm<strong>in</strong>g. Create the M-file called tfunction.m and type <strong>in</strong>Table 3. The M-file tfunction.m turns the force reactions <strong>in</strong> thesecond template <strong>in</strong>to a function of beta and theta. In thecommand w<strong>in</strong>dow, type <strong>in</strong>[F,NA]=tfunction(pi/6,pi/4)and hit enter. The reactions F and N A are displayed.6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!