Practical 1 Installation of Mat Lab
Practical 1 Installation of Mat Lab
Practical 1
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
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
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
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
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
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
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
7
IT Workshop Anshul Pathania
BTCS 305-18 1803654
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
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
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
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
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
13
IT Workshop Anshul Pathania
BTCS 305-18 1803654
14
IT Workshop Anshul Pathania
BTCS 305-18 1803654
PRACTIAL-2
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.
Dividing by zero
16
IT Workshop Anshul Pathania
BTCS 305-18 1803654
17
IT Workshop Anshul Pathania
BTCS 305-18 1803654
Complex problem
MATLAB Variables:
18
IT Workshop Anshul Pathania
BTCS 305-18 1803654
19
IT Workshop Anshul Pathania
BTCS 305-18 1803654
WHOS: This command tells the name of variables,size,bytes used and class.
20
IT Workshop Anshul Pathania
BTCS 305-18 1803654
21
IT Workshop Anshul Pathania
BTCS 305-18 1803654
Practical-3
22
IT Workshop Anshul Pathania
BTCS 305-18 1803654
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:-
(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