ENGINEERING COURSES FOR UNDERGRADUATE STUDENTS
Would you like to react to this message? Create an account in a few clicks or log in to continue.
ENGINEERING COURSES FOR UNDERGRADUATE STUDENTS

LECTURES & APPLICATIONS
 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

 

 START FROM THE BASIC

Go down 
AuthorMessage
Eng.Saeed Almalowi




Posts : 38
Join date : 2009-10-27
Location : UNITED STATE OF AMERICA, STATE COLLEGE,PA

START FROM THE BASIC Empty
PostSubject: START FROM THE BASIC   START FROM THE BASIC Icon_minitimeThu Oct 29, 2009 6:46 am

Calculator functions work as you'd expect:

>>(1+4)*3

ans =

15

+ and - are addition, / is division, * is multiplication, ^ is an exponent.

You can assign variables from the matlab workspace. Everything in matlab is a matrix. (If it's a scalar, it's actually a 1x1 matrix, and if it's a vector, it's an Nx1 or 1xN matrix.)

>>a = 3
a =

3


To create a vector is pretty similar. Each element is separated by spaces, the whole vectore is in square brackets:

>>v = [1 3 6 8 9]

To create a vector of values going in even steps from one value to another value, you would use

>>b = 1:.5:10

This goes from 1 to 10 in increments of .5. You can use any increment, positive or negative, you just have to be able to get to the last thing from the first thing, using those increments. If you don't put in an increment, it assumes it's 1, so 1:5 gives you the vector [1 2 3 4 5].

To turn a row vector into a column vector, just put a ' at the end of it. (This is also how to get the transpose of a matrix.) To create a matrix, you could do something like:

c = [1 3 6; 2 7 9; 4 3 1]

The semicolons indicate the end of a row. All rows have to be the same length.

Whenever you assign a value in matlab,it will print out the entire value you have just assigned. If you put a semicolon at the end, it will not print it out, which is much faster.
Back to top Go down
http://www.aalhameed1.net
 
START FROM THE BASIC
Back to top 
Page 1 of 1
 Similar topics
-
» HEAT TRANSFER PROBLEMS ( BASIC)

Permissions in this forum:You cannot reply to topics in this forum
ENGINEERING COURSES FOR UNDERGRADUATE STUDENTS :: ENGINEERING PROGRAMS/SOFT WARE :: MATLAB PROGRAM FORUM-
Jump to: