Free Essay

In: Other Topics

Submitted By lyh9142739
Words 486
Pages 2
Tutorial 1 – Introduction to MATLAB
When you start MATLAB, the desktop appears in its default layout.

The desktop includes these panels:
• Current Folder — Access your files.
• Command Window — Enter commands at the command line, indicated by the prompt
(>>).
• Workspace — Explore data that you create or import from files.
• Command History — View or rerun commands that you entered at the command line.
Help
- To obtain information or description of particular function.
>> help cos
Exit
- Leave Matlab session
>> exit
Clear
- Removes all variables from the workspace.
>> clear

KMLIM

TCI2261

2012/2013

Scripts

New script

Debugging Tools

`
Variables
As you work in MATLAB, you issue commands that create variables and call functions.
For example, create a variable named a by typing this statement at the command line: a=1 MATLAB adds variable a to the workspace and displays the result in the Command
Window.
a=
1
When you do not specify an output variable, MATLAB uses the variable ans, short for answer, to store the results of your calculation. sin(a) ans =
0.8415
If you end a statement with a semicolon, MATLAB performs the computation, but suppresses the display of output in the Command Window. sin(a); At any time you want to know the active variables you can use:

KMLIM

TCI2261

2012/2013

Arrays
MATLAB is an abbreviation for "matrix laboratory."While other programming languages mostly work with numbers one at a time, MATLAB is designed to operate primarily on whole matrices and arrays.
All MATLAB variables are multidimensional arrays, no matter what type of data. A matrix is a two-dimensional array often used for linear algebra.
Row vector: comma or space separated values between brackets

Column vector: semicolon separated values between brackets

Matrices

Matrix Indexing

KMLIM

TCI2261

2012/2013

Matlab has many types of matrices which are built into the system.

KMLIM

TCI2261

2012/2013

Functions
Initialize built-in function’s values to a variable:

Transpose of a matrix:

Arithmetic operations:

KMLIM

TCI2261

2012/2013

KMLIM

TCI2261

2012/2013

Some Matlab functions can return more than one value. In the case of max the interpreter returns the maximum value and also the column index where the maximum value occurs.

Matlab has a convention in which a dot in front of an operation usually changes the operation. In the case of multiplication, a.*b will perform entry-by-entry multiplication instead of the usual matrix multiplication.

KMLIM

TCI2261

2012/2013

KMLIM

TCI2261

2012/2013

Relations and Logical Operations
In this section you should think of 1 as "true" and 0 as "false." The notations &, |, ~ stand for "and,""or," and "not," respectively. The notation == is a check for equality.

KMLIM

TCI2261

2012/2013

Colon Notation

Use colon notation to select a particular row or column.

KMLIM

TCI2261

2012/2013

Assignment
Assignment is the method of giving a value to a variable.

KMLIM

TCI2261

2012/2013

Branching

For loops

While loops

KMLIM

TCI2261

2012/2013

### Similar Documents

#### Carrers

...Behavioral Interview Questions * Give an example of an occasion when you used logic to solve a problem. * Give an example of a goal you reached and tell me how you achieved it. * Give an example of a goal you didn't meet and how you handled it. * Describe a stressful situation at work and how you handled it. * Tell me about how you worked effectively under pressure. * How do you handle a challenge? * Have you been in a situation where you didn't have enough work to do? * Have you ever made a mistake? How did you handle it? * Describe a decision you made that was unpopular and how you handled implementing it. * Did you ever make a risky decision? Why? How did you handle it? * Did you ever postpone making a decision? Why? * Have you ever dealt with company policy you weren't in agreement with? How? * Have you gone above and beyond the call of duty? If so, how? * When you worked on multiple projects how did you prioritize? * How did you handle meeting a tight deadline? * Give an example of how you set goals and achieve them. * Did you ever not meet your goals? Why? * What do you do when your schedule is interrupted? Give an example of how you handle it. * Have you had to convince a team to work on a project they weren't thrilled about? How did you do it? * Give an example of how you worked on team. * Have you handled a difficult situation with a co-worker? How? * What do you do if you......

Words: 3013 - Pages: 13

#### Accounting

Words: 4063 - Pages: 17

Free Essay

#### Organization

Words: 1559 - Pages: 7

Free Essay

#### Interview

Words: 2234 - Pages: 9

Free Essay

#### What Gives You Pleasure

...“What gives you pleasure?” and “What makes you feel good?” Those are questions I don’t really often ask myself. It’s not like they are hard questions but to me in actuality they are. I always wonder with these types of questions if I am giving the right answer or if there is even a right answer. I don’t think there is a right or wrong answer in general. The best answer is the one you give. We all have our own definition of pleasure and what makes us feel good. What brings me the most pleasure and makes me feel good first and foremost are my kids. I was told I would never be able to have kids, but God has blessed me with two beautiful girls. I enjoy all my time with them both. I guess you could also say that being a mom also brings me pleasure and makes me feel good. I couldn’t imagine doing anything else in the world. I never pictured myself the mother type but it suits me. Being a mom to my girls is something that brings me joy; makes my heart swell up with pride just knowing that I made those girls and they love me no matter what. Of course other things in this world bring me pleasure and make me feel good. Things such as friends and family, music, sweets like chocolate, and big bear hugs. I love having an intimate relationship with my best friend; it gives me no greater pleasure to know that I am sharing my life forever with him. I also enjoy jumping in my car and going for a ride with the windows down and music blasting, not a care in the world and nowhere to be. I......

Words: 392 - Pages: 2

#### Marketing

Words: 7749 - Pages: 31

Free Essay

#### 10 Popular Interview Questions

Words: 1807 - Pages: 8

#### The Toughest Questions You Face in a Job Interview

...How would you describe yourself? Answers: I'm a people person. I really enjoy meeting and working with a lot of different people. I'm a perfectionist. I pay attention to all the details, and like to be sure that everything is just right. I'm a creative thinker. I like to explore alternative solutions to problems and have an open mind about what will work best. I'm efficient and highly organized. This enables me to be as productive as possible on the job. I enjoy solving problems, troubleshooting issues, and coming up with solutions in a timely manner. What skills do you have? What let you choose your major field of study? Why should I hire you? Answers: Everyone needs a job, but not everyone can do what I’m capable of. I understand your position requirements and if you take a look at my resume, I am quite certain that you will find that my skills and potential over and above exceed the qualifications and responsibility for this job. So, Is there a reason why you should not hire me? You will hire me because I have good communication skills to convince anyone, good leadership qualities and if this is not enough I am a quick learner and love to learn all new things which can give good returns to my future growth. These are the qualities I have which will be a value addition for any company as well as for my career and I believe nobody wants to lose a good resource. I can surpass your expectations only if you give a chance to proof my managerial skills and......

Words: 1336 - Pages: 6

#### Pharma Marketing

Words: 3777 - Pages: 16

Free Essay

#### 口语弊病

Words: 4529 - Pages: 19

#### Case Guide

...CPC INTERVIEW GUIDE 1. Introduction 2. Preparing for the Interview 3. Dressing for Success 4. Types of Interviews a. 1st Round – Screening b. 2nd Round – Selection c. Telephone Interviews d. Behavioural-Based Interviews (BBI) e. Case Interviews 5. Questions you might ask at an interview 6. Follow-Up Tips 7. Sample Questions a. Common Interview Questions b. Behavioural-Based Interview Questions c. Case Interview Questions 8. Resources CPC Interview Guide, Page 1 of 26 1. Introduction One of the most important things to remember about any job interview is that its main objective is to allow for an exchange of information between both parties (applicant and company), so that a determination can be made as to how well the applicant fits the position/ company and/or vice-versa. As the applicant, you want to impress upon the employer how your background (i.e., education, previous employment/volunteer positions, extra-curricular and hobbies) matches the requirements of the position they are recruiting for. Your résumé will have given them some indication of how well you match, but during the interview you are expected to expand on this and be able to demonstrate strong communication skills. Your communication skills (oral, written and non-verbal) will be evaluated closely and are expected to be well practiced. Other skills critical to the position/company will also be evaluated, so make sure you have done research on the position and the needs of the......

Words: 7536 - Pages: 31

#### Talent Management

Words: 3108 - Pages: 13

#### Module 1

Words: 3033 - Pages: 13

Free Essay