Computing Tools For Mathematics :Topic :Installation And Interface
Computing Tools For Mathematics(COMP1118)
Instructor : Engineer Imran Ahmad
University Of Okara (Renala Campus)
Lesson 2 :Installation And Interface
Installation
Installing MATLAB a minimum, you need 3GB of free hard drive space and 2GB of RAM to use MATLAB effectively. Before you can work with MATLAB, you need a copy installed on your system. Here are the three most common ways of getting MATLAB:
✓ Get the trial version from https://www.mathworks.com/programs/trials/trial_request.html.
✓ Obtain a student version of the product from https://www.mathworkscom/academia/student_version/.
✓ Buy a copy from
http://www.mathworks.com/pricing-licensing/index.html.
Installation Step :
The simplest way to install Matlab is to run "SetupSimple.exe"
Do not close "SetupSimple" program until installation of Matlab is finished.
When you will be asked to activate the, program REFUSE to do so.
If simplified setup does not work for you just execute following steps manually:
(to save time try to execute STEP 6 ONLY ... and if it did not helped - execute all steps from step 1)
(let the "X:\" be the letter of mounted Matlab iso-image)
1) run "X:\setup.exe"
OR
run "X:\bin\win32\setup.exe" (if you want to install 32-bit Matlab under 64-bit Windows)
2) choose "install manually without using the internet"
3) when you will be asked to enter the "file installation key" use
XXXXXXXXXXXXXXXXXXXXXXXXXXX
4) setup Matlab (if you want Matlab to use less space and be little bit faster select "Custom" setup
and select ONLY components required for you)
5) when you will be asked to activate the product you can refuse to activate
OR
select activation without internet and use "X:\serial\license.lic" as license file
If you need server components of Matlab (suppose you know what you are doing) then at step 3 use:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Try not to install in C drive
Interface of Matlab
✓ Quick Access toolbar:
The Quick Access toolbar (QAT) provides access to the MATLAB features that you use most often.
✓ Minimize Tool strip:
If you find that the Toolstrip is taking up too much space, you can click the Minimize Toolstrip icon to remove it from view.
✓ Command window:
You type formulas and commands in this window.
✓ Workspace window:
The Workspace window contains the results of any tasks you ask MATLAB to perform.
✓ Command History window:
Command History window acts as your memory and helps you restore formulas and commands that you used in the past.
✓ Status bar:
It’s important to know the current MATLAB state — whether MATLAB is ready to perform additional work or not.
✓ Details window:
The Details window shows specifics about any file you select in the Current Folder window.
✓ Current Folder window and Address Field:
The Current Folder window contains a listing of the files you’ve created in the current folder — files
Using MATLAB as a Calculator
The promptis that place where you type formulas, commands, or functions or perform tasks using.MATLAB. It appears in the Command window. Normally, the prompt appears as two greater-than signs (>>).
To enter a formula you simply type it. For example, if you type 2 + 2and press Enter, you get an answer of 4. Likewise, if you type 2 * pi * 6378.1and press Enter, you get the circumference of the earth in km
✓ ans:
Contains the most recent temporary answer. MATLAB creates this special temporary variable for you when you don’t provide a variable of your own.
✓ i:
Contains an imaginary number, which defaults to 0.0000 + 1.0000i.
✓ Inf:
Defines a value of infinity, which is any number divided by 0, such as 1 / 0.
✓ NaN:
Specifies that the numerical result isn’t defined (Not a Number).
✓ pi:
Contains the value of pi, which is 3.1416 when you view it onscreen.
Number format commands
Internally, MATLAB stores the value to 15 decimal places so that you’re assured of accuracy. MATLAB provides a number of format. commands. Each of them begins with the keyword format, followed by an additional instruction. Here is a list of the instructions you can type:
✓ short:
All floating-point output has at least one whole number, a decimal point, and four decimal values, such as 4.2000.
✓ long:All floating-point output has at least one whole number, a decimal point, and 15 decimal values, such as 4.200000000000000.
✓ shorte:
All floating-point output uses exponential format with four decimal places, such as 4.2000e+00.
✓ longe:
All floating-point output uses exponential format with 15 decimal places, such as 4.200000000000000e+00.
✓ shortg:
All output uses a short general format, such as 4.2, with five digits of space.
✓ long:
All output uses a long general format, such as 4.2, with 15 digits of space.
✓ shorteng:
All floating-point output uses exponential format with four decimal places and powers in groups of three, such as 4.2000e+000.
✓ longeng:
All floating-point output uses exponential format with 14 decimal places and powers in groups of three, such as 4.20000000000000e+000.
✓ hex:
All output is in hexadecimal format, such as 4010cccccccccccd.
Number format commands Contd…..
✓ +: All output is evaluated for positive or negative values, so that the result contains just a + or - sign, such as + when using the formula 2 * 2.1.
✓ bank: All output provides two decimal places, even for integer calculations, such as 4.20.
✓ rat: All output is presented as a ratio of small integers, such as 21/5 for 4.2.
✓ compact:All output appears in single-spaced format.
✓ loose: All output appears in double-spaced format.
Adding, subtracting, multiplying, and dividing
✓ +or plus(): Adds two numbers. For example, you can use 3 + 4or plus(3, 4)to obtain a result of 7.
✓ -or minus(): Subtracts two numbers. For example, you can use 3 - 4or minus(3, 4)to obtain a result of –1.
✓ *or times(): Multiplies two numbers. For example, you can use 3 * 4 or times(3, 4)to obtain a result of 12.
✓ /or rdivide(): Performs right division, which is the form of division you likely learned in school. For example: you can use 3 / 4 or rdivide(3, 4)to obtain a result of 0.75.
Basic unary operators
Most MATLAB operators are binary, which means that they work on two values. For example, 3 + 4 has two values: 3and 4. However, some operators are unary, which means that they work on just one value. Here are the basic unary operators:
✓ +or uplus(): Returns the unmodified content of a value or variable.
For example, +1or uplus(1)is still equal to 1.
✓ -or uminus(): Returns the negated content of a value or variable. For example, -1or uminus(1)returns –1. However, -–1or uminus(–1)turns 1(the negative of a negative is a positive). ✓ mod():Obtains the modulus after division. For example, mod(5, 3) produces an output of 2and mod(5, –3)produces an output of 1.
✓ rem(): obtains the remainder after division. For example, rem(5, 3)produces an output of 2and rem(5, –3)produces an output of 2.
Working with exponents
You use the caret (^) to raise a number to a particular power. MATLAB can handle negative, ractional, and complex number bases as exponents. Here are some examples of exponents:
✓ 10^3 = 1000
✓ 2^10 = 1024
✓ 2.5^2.5 = 9.8821
✓ 2^-4 = 0.0625
✓ 2^i = 0.7692 + 0.6390i
✓ i^i = 0.2079
Valid variable name
✓ Start with a letter
✓ Add:
• Letters
• Digits • Underscores
With this in mind, naming a variable 7Heavendoesn’t work because this particular variable name begins with a number — and variables must begin with a letter.
✓ MyVariable
✓ My_Variable
✓ My7Joys
In each case, the variable name begins with a letter and is followed by a letter, digit, or underscore. If you violate any of these rules, you see this error message:
Error: Unexpected MATLAB expression.
Comparisons
Computers can perform comparisons and report whether something is true (it does compare) where an output value of 1 means the statement is true and an output value of 0 means the statement is false).
Function
Using the built-in functions Previous sections of this chapter introduce you to a number of MATLAB functions, but we have barely scratched the function surface.
MATLAB has a lot of other functions, such as sin(), cos(), tan(), asin(), acos(), atan(),
log(), and exp().
Assignment no 1
Q#01 What is MATLAB and history of MATLAB?Q#02 What types of function used in MATLAB?
Submitted your assignment in hand written form not in printed or soft form
Deadline till 14-03-2017
Not acceptable after 10:am
Comments
Post a Comment