0% found this document useful (0 votes)
17 views

Introduction To MATLAB 3

The document provides an introduction to MATLAB in 6 parts: 1) familiarizing the user interface, 2) types of variables, 3) basic arithmetic operations on variables, 4) loops, 5) functions, and 6) visualization and post processing. It also includes examples of practice problems involving loops, functions, and basic arithmetic operations on variables.

Uploaded by

cipag98409
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Introduction To MATLAB 3

The document provides an introduction to MATLAB in 6 parts: 1) familiarizing the user interface, 2) types of variables, 3) basic arithmetic operations on variables, 4) loops, 5) functions, and 6) visualization and post processing. It also includes examples of practice problems involving loops, functions, and basic arithmetic operations on variables.

Uploaded by

cipag98409
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Introduction to MATLAB

Part 1: Familiarize the user interface


 Explain the user interface: Workspace, Editor, Command window
 Some important functions: Run, breakpoints, pause
 How to open a new script, save the script and execute the script.
 How to clear the workspace and command window
 How to comment and save the workspace

Part 2: Types of variables


For each variable-type the following components can be explained.
 Defining the variable (how to define specific type of variable, long, character)
 Assigning the values to variable
 Show the workspace of the variable (how the values are stored)
 Get (referring) the value of the variable (indexing)
 Size() and length() functions can be shown
Types of variables
 Scalar variable
 Array (1D, 2D)
 Forming a matrix of 𝑛 ∗ 𝑚 using 2D array

Part 3: Basic arithmetic operations on variables


 Addition/subtraction/multiplication/division of scalar variable
 Addition/subtraction of matrices
 Operations on single element of the array
 Operations on single row of the array/matrix
 Operations on single column of the array/matrix
 Matrix multiplication and division using inv() function

Part 4: Loops
 Why loops?
 Logical expression (< , <= , > , >= , == )
 Usage of For and While loops

Part 5: Functions
 Why Functions?
 How to define the Fucntion (format)
 Using the Function in the main code

Part 6: Visualization and post processing


Explain following commands with basic features:
plot(x,y) contour(x,y,z) semilogx(x,y) semilogy(x,y)
Practice problems
Summation of numbers (basic, Loops)
Declare the set of numbers:
Numbers from 1 to N (a = [1 2 3 4 … N])
Or
User defined array (a = [1 3 8 6 10 5 …])
Or
Integers between 1 and 2x (x is the input)
Use For and While loop to compute the sum of all the number

Find the largest number in the set (intermediate, Loops)


Declare the set of numbers from the user (a = [1 3 8 6 10 5 …]).
Use For and While loop to compare two numbers consecutively and find the largest number
in the set.

Construct the common array S3 (intermediate, Loops)


Declare two arrays S1 and S2 containing the numbers. Construct S3, a new array, such that
it contains both S1 and S2 and is as short as possible (no repetition of the numbers and use
nested loops).
Example:
S1 = [1 2 3 4 5], S2 = [5 10 1 20 16 37]
S3 = [1 2 3 4 5 10 20 16 37]
Use For and While loop to compare the arrays S1 and S2 and create the S3 by knowing the
repeated elements.

Find the factors (basic, Functions)


For the given set of numbers, find all the factors of each number and tabulate.

Step 1. Declare the number set from the user defined input (a = [1 3 8 6 10 5 …])
Step 2. Write a Function to find all the factors of a given number
Step 3. Use this function to get the factors for all the numbers in the set using a loop
Step 4. Tabulate the data and print it

You might also like