EEE 322, Power System-I Laboratory
Experiment-1

INTRODUCTION TO MATLAB AND ITS BASIC COMMANDS

Q. 1-1. What is MATLAB?

Ans: MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation. Typical uses include:

·        Math and computation.

·        Algorithm development.

·        Modeling, simulation, and prototyping.

·        Data analysis, exploration, and visualization.

·        Scientific and engineering graphics.

·        Application development, including Graphical User Interface building.

MATLAB is an interactive system whose basic data element is an array that does not require dimensioning. This allows solving many technical computing problems, especially those with matrix and vector formulations, in a fraction of the time it would take to write a program in a scalar noninteractive language such as C or Fortran.


Q. 1-2. What is the elaboration of MATLAB?

Ans: The name MATLAB stands for ‘matrix laboratory’. MATLAB was originally written to provide easy access to matrix software developed by the LINPACK and EISPACK projects, which together represent the state-of-the-art in software for matrix computation.

 

Q.1-3. How can you find information on specified functions as to their use and purpose?

Ans: To find information on a specified function as to its use and purpose, we have to type in the command window ‘help’ then give a space and then type ‘the name of the function’ we want to find about.

 

Q. 1-4. Write about specifying the variable name and not specifying the variable name?

Ans: Specifying variables: Specifying variables start with a letter, followed by letters, digits, or underscores. such as x1, Last value, n_factorial, etc. Otherwise, variables would act like non-specifying variables.

 

Q. 1-5. What are the functions of the following commands? (1) exp (2) sqrt (3) disp (4) input (5) norm (6) acos (7) plot (8) bar.

Ans:  (1) exp command is used for functioning the exponential operations.

(2) sqrt command is used for squaring any value.

(3) disp command is used for displaying outputs.

(4) input command is used for taking inputs from the user.

(5) norm command is used for taking the value of a vector.

(6) acos command is used for functioning the cos-1 operation

(7) plot function is used to create a graphical representation of some data.

(8) bar command is used for creating a bar graph

 

Q. 1-6. Write about (1) Zero vector (2) One vector (3) Positive increment (4) Negative increment (5) Increment other than unity.

Ans: (1) Zero vector: It is a vector with all components equal to zero. For example, to build a zero vector of size 4, the following command

Z = zeros (1,4)

results in

Z= 0 0 0 0

(2) One vector: It is a vector with each component equal to one. To generate one vector of size 4, use

I = ones (1,4)

The result is

I = 1 1 1 1

(3) Positive increment: To generate a row vector, colon (:) can be used in MATLAB. For example: x=1:8

generates a row vector of integers from 1 to 8,

x= 1 2 3 4 5 6 7 8

(4) Negative increments: For negative increments, the first number would be greater than the last number and, in the middle, we have to use a negative number such as

x = 5: -1:1 result in

x = 5 4 3 2 1

(5) Increment other than unity: For increments other than unity, the following command

z = 0: pi/3: pi

results in

z = 0000 1.0472 2.0944 3.1416