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

Practical 1 Installation of Mat Lab

The document provides step-by-step instructions for installing MATLAB software without an internet connection. It details the preparation needed, starting the installer, specifying the file installation key, choosing installation options, and completing the installation process.

Uploaded by

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

Practical 1 Installation of Mat Lab

The document provides step-by-step instructions for installing MATLAB software without an internet connection. It details the preparation needed, starting the installer, specifying the file installation key, choosing installation options, and completing the installation process.

Uploaded by

Karan Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 31

IT Workshop Anshul Pathania

BTCS 305-18 1803654

Practical 1

Installation of Mat lab


Introduction:
The name MATLAB stands for Matrix Laboratory. MATLAB was written originally to
provide easy access to matrix software developed by the LINPACK (linear system package)
and EISPACK (Eigen system package) projects.
MATLAB is a high-performance language for technical computing. It integrates
computation, visualization, and programming environment. Furthermore, MATLAB is a
modern programming language environment: it has sophisticated data structures, contains
built-in editing and debugging tools, and supports object-oriented programming. These
factors make MATLAB an excellent tool for teaching and research.
MATLAB has many advantages compared to conventional computer languages (e.g., C,
FORTRAN) for solving technical problems. MATLAB is an interactive system whose basic
data element is an array that does not require dimensioning. The software package has been
commercially available since 1984 and is now considered as a standard tool at most
universities and industries worldwide.
It has powerful built-in routines that enable a very wide variety of computations. It also has easy
to use graphics commands that make the visualization of results immediately available. Specific
applications are collected in packages referred to as toolbox. There are toolboxes for signal
processing, symbolic computation, control theory, simulation, optimization, and several other
fields of applied science and engineering

Step 1:- Preparation

To run the installer interactively without an internet connection, you need the following:
 Have your File Installation Key and License File available. You need both these items to
perform an off-network installation and activation.
The File Installation Key identifies the products you can install. The License File activates the
installation, identifying which products you can run. The administrator of the license can retrieve
the File Installation Key and License File by visiting the License Center at the Math
Works® website. Download and save these items on removable storage (for example, USB stick)
and copy to the target machine.
 Ensure that the product files, including the MATLAB® installer, are available in an
accessible location, for example, in the default Downloads folder on your computer or on a
network share. If the product files are located in a folder other than the default Downloads folder
on your computer, the installer file must be located in the same folder as the product files.

1
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Step 2:- Start the Installer

1. Copy the products files (including the installer file) to your computer or an accessible
location (for example, USB drive or network share).
2. Start the installer. The method you use to start the installer depends on your platform.
 Windows
If you or an administrator downloaded the product files previously and copied the
product files to your computer, a network share, or to media, go to the top level of the
folder where the product files are located and click setup.exe.

 Mac OS
If you or an administrator downloaded the product files and copied the extracted files to
your computer, a network share, or to media, go to the top level of the folder where the
product files are located and double-click the Install for Mac OS X icon to begin the
installation.

 Linux
If you or an administrator downloaded the product files and copied the extracted files to
your computer, a network share, or to media, go to the top level of the folder where the
product files are located and execute the installer command:install

Step 3:- Install with the file installation key

If you do not have an Internet connection, but have access to product files on your computer or
on a network share, select the Use a File Installation Key option and click next
.

2
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Step 4:- Review the License Agreement

Review the software license agreement and, if you agree with the terms, select Yes and
click Next.

3
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Step 5:- Specify the File Installation Key

 If you do not have an Internet connection, and choose to install manually, the installer
displays the File Installation Key dialog box. A File Installation Key identifies the
products you can install.
 If you have the key, select the I have the File Installation Key for my license option,
enter the File Installation Key, and click next. The administrator on a license can retrieve
the File Installation Key from the License Center at the MathWorks website.
 If you do not have the key, select the I do not have the File Installation Key option and
click next. The installer provides you with the information you need to get a key.

4
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Step 6:- Specify the Installation Folder

 Specify the name of the folder where you want to install MathWorks products. Accept
the default installation folder, or click Browse to select a different one.
 If the folder does not exist, the installer creates it.

5
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Step 7:- Specify the Products To Install

 Specify which products you want to install in the Product Selection dialog box. This
dialog box lists all the products associated with the license you selected or with the
Activation Key you specified.
 In the dialog box, all the products are preselected for installation. If you do not want to
install a particular product, clear the check box next to its name.
 After selecting the products you want to install, click Next to continue with the
installation

6
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Step 8:- Specify Installation Options


You can specify optional installation options, depending on your platform.
 Windows Systems
On Windows®, the Installation Options dialog box offers you the option to put shortcuts for
starting MATLAB in the Start menu and on the desktop

7
IT Workshop Anshul Pathania
BTCS 305-18 1803654

After selecting installation options, click Next to proceed with the installation.

 Linux Systems
 On Linux systems, you can specify whether you want to create symbolic links to the mat
lab and mex scripts. Specify a folder to which you have write access and that is common
to all your user's paths, such as /usr/local/bin.
 After selecting installation options, click Next to proceed with the installation.

8
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Step 9:- Confirm Your Choices

 Before it begins installing the software on your hard disk, the installer displays a
summary of your installation choices.
 To change a setting, click Back. To proceed with the installation, click Install

9
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Step 10:- Complete the Installation

 When the installation successfully completes, the installer displays the Installation
Complete dialog box. In this dialog box, you can choose to activate the software you just
installed. You cannot use the software you installed until you activate it.
 Running activation immediately after installation is the fastest way to start using
MATLAB. Click Next to proceed with activation.
 If you choose to exit the installer without performing activation, clear the Activate
MATLAB option and click Finish (the button label changes).
 You can activate later using the activation application.

10
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Step 11:- Now Start the Activation

 Because you were not logged in to your MathWorks® Account during installation, or you
started the activation application independently, you must choose whether to activate
automatically or manually.
 Select the Activate manually without the Internet (recommended) option and
click Next

11
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Step 12:- Specify the path to the License

 To activate without an Internet connection, you must have a License File. The License
File identifies which products you can run. The administrator on the license can retrieve
the License File from the License Center at the Math Works website.
 Select the Enter the full path to your license file, including the file name option and
enter the full path of your License File in the text box (or drag and drop the file) and
click Next.
 If you do not have your License File, select the I do not have a license file option and
click Next to get information about how to retrieve a License File.

12
IT Workshop Anshul Pathania
BTCS 305-18 1803654

If You Do Not Have a License File


 Save the information displayed in this dialog box. You can print a copy of this
information by clicking Print. Take the information to a computer with an Internet
connection and visit the License Center at the Math Works website. Math Works uses
this information to generate a File Installation Key and a License File.
 You must have this information with you when you return to the computer on which you
want to install and activate the software.
 To exit the activation application, click Finish.

13
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Step 13:- Complete the Activation


After activating your installation, click Finish to exit the activation process.

Step 14:- What’s Next?


Now that MATLAB and any accompanying toolboxes have been installed, you are ready to
begin using MathWorks software.

14
IT Workshop Anshul Pathania
BTCS 305-18 1803654

PRACTIAL-2

Basic Syntax & Matlab Variables


MATLAB as Calculator

Addition: ‘+’ operator is used to add two numbers.


Subtraction: ‘-’ operator is used to subtract two numbers.

Multiplication: ‘*’ operator is used to multiply two numbers.


Division: ‘/’ operator is used to divide two numbers.

15
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Power Function: ‘^’ operator is used to calculate power of a number. Eg: x^y gives x raised to
power y.

Modulus Operator:mod(num1,num2) is used to calculate the modulus of two numbers. Modulus


operator gives us the remainder after dividing the number.

Dividing by zero

16
IT Workshop Anshul Pathania
BTCS 305-18 1803654

MIN Function: It returns minimum value from two entered values.

MAX Function: It returns maximum value from two entered values.

Trigonometric Function:  These functions are used for trigonometric calculations.

PWD Function: It returns path to current folder.

17
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Complex problem

Date function:  Date returns the current date.

MATLAB Variables:

18
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Square root – It is used to find square root of a number.

WHO: This command tells the name of variables used.

19
IT Workshop Anshul Pathania
BTCS 305-18 1803654

WHOS: This command tells the name of variables,size,bytes used and class.

CLEAR FUNCTION :This command is used to clear workspace area.

20
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Clc  command– This command is used to clear command window. 

21
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Practical-3

MATLAB Vectors and Matrices

1) MATLAB Vectors :- In MATLAB you can create vectors using [ ] bracket.

There are two types of vectors :-

(a) Row vectors :-

Addition and Subtraction of row vectors :-

22
IT Workshop Anshul Pathania
BTCS 305-18 1803654

(b) Column vectors :-

Addition and Subtraction of Column Vectors:-

23
IT Workshop Anshul Pathania
BTCS 305-18 1803654

2) MATLAB Matrix :-In MATLAB you can create a matrix by entering elements in each

row as comma or space delimited numbers and using semicolon to mark the end of each row.

Operations on matrices:-

(a) Addition of matrices.

(b)Subtraction of matrices.

24
IT Workshop Anshul Pathania
BTCS 305-18 1803654

(c)Multiplication of matrices.

(d)Division of matrices.

25
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Practical-4
Write a program to add, subtract, multiply, divide two number using editor

a=4
b=3
fprintf (' sum is %d ', a+b)
fprintf ('\n subtraction is %d', a-b)
fprintf ('\n multiplication is %d', a*b)
fprintf ('\n division is %d', a/b)

OUTPUT:

26
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Practical-5
Write a program to find the larger number between two using simple if

a=4
b=3
if (a>b)
disp ('a is greater')
end
if (b>a)
disp ('b is greater')
end

Output

27
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Practical-6
Write a program to find the larger number between two using if else.

a=4
b=3
if(a>b)
disp('a is greater')
else
disp('b is greater')
end

OUTPUT:

28
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Practical-7
Write a program to find the largest number between three numbers using if else.

a=4
b=3
c=9
if(a>b)
if(a>c)
disp ('a is greatest');
elseif (c>b)
disp ('c is greatest');
end
elseif (b>c)
disp ('b is greatest');
end

Output

29
IT Workshop Anshul Pathania
BTCS 305-18 1803654

Practical 8
Write a program to display weekdays using switch.

a=4
switch(a)
case 1
disp('Monday');
case 2
disp('Tuesday');
case 3
disp('Wednessday');
case 4
disp('Thursday');
case 5
disp('Friday');
case 6
disp('Saturday');
otherwise
disp('Sunday');

end

OUTPUT:

30
IT Workshop Anshul Pathania
BTCS 305-18 1803654

31

You might also like