Experiment No. (1) - an introduction to MATLAB

Slides:



Advertisements
Similar presentations
 2005 Pearson Education, Inc. All rights reserved Introduction.
Advertisements

1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
1 Outline 13.1Introduction 13.2A Simple Program: Printing a Line of Text in a Web Page 13.3Another JavaScript Program: Adding Integers 13.4Memory Concepts.
Introduction to MATLAB 7 for Engineers
Introduction to MATLAB
Introduction to MATLAB ENGR 1187 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
Introduction to programming in MATLAB MATLAB can be thought of as an super-powerful graphing calculator Remember the TI-83 from calculus? With many more.
Lecture 1: Introduction Lecture series based on the text: Essential MATLAB for Engineers and Scientists By Hahn & Valentine
Python Programming Fundamentals
BRIAN D. HAHN AND DANIEL T. VALENTINE THIRD EDITION Essential MATLAB® for Engineers and Scientists.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB is a powerful program for numerical computations, plotting and programming.
Introduction to MATLAB ENGR 1181 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
A Brief introduction to MatLAB ($50 - $99 for students)
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
Introduction to Engineering MATLAB – 2 Introduction to MATLAB - 2 Agenda Defining Variables MATLAB Windows.
CMPS 1371 Introduction to Computing for Engineers MatLab.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
MATLAB Technical Computing Environment. MATLAB Matlab is an interactive computing environment that enables numerical computation and data visualization.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1 Week 1: Variables, assignment, expressions READING: 1.2 – 1.4.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Chapter 6 Review: User Defined Functions Introduction to MATLAB 7 Engineering 161.
Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz “Lecture 2”
 2000 Deitel & Associates, Inc. All rights reserved. Outline 8.1Introduction 8.2A Simple Program: Printing a Line of Text in a Web Page 8.3Another JavaScript.
1 Lecture 1 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
EGR 115 Introduction to Computing for Engineers Introduction to MATLAB Friday 29 August 2014 EGR 115 Introduction to Computing for Engineers.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Interduction to MATLAB Manal Alotaibi Mathematics department College of science King saud university.
ENG 1181 First-Year Engineering Program College of Engineering Engineering Education Innovation Center First-Year Engineering Program MAT - Introduction.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
Fundamentals of Programming I Overview of Programming
Introduction to MATLAB
ECE 1304 Introduction to Electrical and Computer Engineering
Chapter 6 JavaScript: Introduction to Scripting
Introduction to Matlab
Programming Fundamental
Lecture: MATLAB Chapter 1 Introduction
MATLAB Basics Nafees Ahmed Asstt. Professor, EE Deptt DIT, DehraDun.
Introduction to MATLAB for Engineers, Third Edition
Revision Lecture
Variables, Expressions, and IO
Basic operations in Matlab
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
Matlab Workshop 9/22/2018.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 2 Applications and Data.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Lecture 1: Introduction
WEB PROGRAMMING JavaScript.
Use of Mathematics using Technology (Maltlab)
T. Jumana Abu Shmais – AOU - Riyadh
Introduction to Matlab
INTRODUCTION TO MATLAB
Matlab.
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
Engineering Problem Solving with C++ An Object Based Approach
Engineering Problem Solving with C++ An Object Based Approach
Using Script Files and Managing Data
MATLAB Introduction MATLAB can be thought of as a powerful graphing calculator but with a lot more buttons! It is also a programming language, commands.
Computer Simulation Lab
MatLab Program Used to Calculate Interactive
Introduction to Matlab
Chapter 2 MATLAB Environment
Electrical and Computer Engineering Department SUNY – New Paltz
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Experiment No. (1) - an introduction to MATLAB College of engineering Third class Computer engineering department Digital signal process Experiment No. (1) - an introduction to MATLAB

Introduction The name MATLAB stands for Matrix Laboratory. MATLAB is a high-performance language for technical computing. MATLAB is a modern programming language environment: it has sophisticated data structures, contains built-in editing and debugging tools, and supports object-oriented programming.

You get MATLAB to do things for you by typing in commands in the command line. When you start MATLAB, a special window called the MATLAB desktop appears.

The major tools within or accessible from the desktop are: • The Command Window • The Command History • The Workspace • The Current Directory • The Help Browser • The Start button Using MATLAB as a calculator To do some simple calculations with the MATLAB desktop on our computers, which contains the prompt (>>) in the Command Window. For example, let’s suppose you want to calculate the expression, 1 + 2 × 3. >> 1+2*3 ans = 7

Variables Variables in MATLAB are named objects that are assigned using the equals sign (=) They are limited to 31 characters. It may consist only of the letters a–z, the digits 0–9 and the underscore ( _ ) It must start with a letter. Examples of valid variable names are: r2d2, car, pay_day. Examples of invalid names: pay-day, 2a, name$, _2a. A variable is created simply by assigning a value to it at the command line or in a program, e.g. a = 98 MATLAB is case sensitive, which means it distinguishes between upper and lowercase letters. So balance, BALANCE and BaLance are three different variables.

General commands and Special characters and variables Expressions and statements The expressions are such as u*t - pi/2 Expressions are constructed from a variety of things, such as numbers, variables, and operators. The statements, such as: y = x + y General commands and Special characters and variables Command Explanation whos lists more information about each variable in the work space pi π =3.1415 9 i, j value of variables. format format long , format short. Clc this command remove everything from the workspace. , b=cos(a), ; a=7; Help Display help text in Command Window. inf Infinity NaN stands for “not a number”; e.g., the result of 0/0 Rand  

Arithmetic operators Relational operators <, <=, >, >= == operation Algebraic form MATLAB addition a + b subtraction a-b a - b multiplication a x b a * b Right division a/b a / b (e.g. 10/5 is 2) Left division b/a a \ b (e.g. 5\10 is 2) power ab a ^ b Relational operators The command explanation <, <=, >, >= usual relational operators == equality operator ~= inequality operator

Precedence of operators 1 Parentheses (round brackets) 2 Power, left to right 3 Multiplication and division, left to right 4 Addition and subtraction, left to right Example1: to evaluate the following equation, this is computed correctly by the MATLAB command: >> TC = (5/9)*(TF-32)

The input statement It is used to read a variable’s value during the runtime. The general form is: Variable_name = input ( ' message ') For example Age = input (' Enter the age of the person in question: ') The M-Files for more complex commands we can store the typed input into a file and tell MATLAB to get its input from the file. Such files must have the extension “.m”. called m-files. If an m-file contains MATLAB statements just as you would type them into MATLAB, they are called scripts. M-files can also accept input and produce output, in which case they are called functions.

Procedure: Write a MATLAB code to evaluate the following:   1.5 * 10-4 +2.5 * 10-2 𝟏 𝟐+𝟑𝟐 + 𝟒 𝟓 ∗ 𝟔 𝟕 Write the following help database.close a=5; b=6, c=7, Use the command who format short ; 2 * sin(1.4) format long ; 2 * sin(1.4) clock = 1; rand(sum(3*clock))

MATLAB is a programming environment which has gained popularity due to its ease of use. MATLAB provides an interactive environment that makes this easy: you type a command, and it executes it. If there is a problem, it will let you know, and you can try again. It executes and works with variables without the need to declare variables first. Q) Write M file to solve this equation and print the value of y : y=1.5 * 10-4 +2.5 * 10-2?