Upload
moeen-khan-afridi
View
96
Download
4
Tags:
Embed Size (px)
Citation preview
Grading Criteria
March – July 2012CECOS College of Engineering and IT
Signals and Systems Lab Course
Attendance……….10%
Lab Tasks…………..30%
Project………………20%
Lab exam..………...20%
Viva…………………..20%
To download manuals and software from lab server
Goto : start >> Run >> write \\dsp-server
March – July 2012CECOS College of Engineering and IT
Accessing lab server
Getting Familiar with MATLAB
Designed by : Dawar [email protected]
March – July 2012CECOS College of Engineering and IT
Lab No.01
March – July 2012CECOS College of Engineering and IT
MATLAB
Software by MathWorks
Matrix Laboratory
Every thing is treated as matrix
Integrates computation, visualization, and programming
in an easy-to-use environment
A high-level technical computing language and interactive
environment for algorithm development, data
visualization, data analysis, and numeric computation
March – July 2012CECOS College of Engineering and IT
MATLAB
add-on toolboxes provide application specific commands
The power lye in rich libraries and toolboxes for almost
every field of engineering
March – July 2012CECOS College of Engineering and IT
Starting/Ending MATLAB
Double click MATLAB icon to launch MATLAB
A command window will appear with the prompt
>>
you are now in MATLAB
To quit from MATLAB write “exit” or “quit” on MATLAB
prompt and press enter
March – July 2012CECOS College of Engineering and IT
MATLAB Interface
Command windowCurrent directory
Command history
Workspace
March – July 2012CECOS College of Engineering and IT
Variables
User defined variables
(“^” , is used for power)
March – July 2012CECOS College of Engineering and IT
Variables
Suppressing output (use semi colon at the end of instruction)
Value of variable
March – July 2012CECOS College of Engineering and IT
Variables Knowing your active variables
>> who
Your variables are:
ans x y
To remove a variable, write clear variablename
>> clear x
To remove all the variables from workspace, use clear
>> clear
March – July 2012CECOS College of Engineering and IT
Variable arithmetic
2+3*4^2 <== exponent has the highest precedence
==> 2 + 3*16 <== then multiplication operator
==> 2 + 48 <== then addition operator
==> 50
March – July 2012CECOS College of Engineering and IT
Predefined trigonometric functions
Function Meaning Example===========================================================sin sine sin(pi) = 0.0cos cosine cos(pi) = -1.0tan tangent tan(pi/4) = 1.0asin arcsine asin(1)= 1.5708acos arccosine acos(1)= 0.0atan arctangent atan(1)= 0.7854exp exponential exp(1.0) = 2.7183log natural logarithm log(2.7183) = 1.0log10 logarithm base 10 log10(100.0) = 2.0===========================================================
The arguments of trigonometric functions are given in radians
March – July 2012CECOS College of Engineering and IT
Verify that
sin2(x)+ cos2(x) = 1
For arbitrary x, the MATLAB code will be:
Practice
March – July 2012CECOS College of Engineering and IT
MATLAB Help
www.mathworks.com
>> help
>> help <command name>
March – July 2012CECOS College of Engineering and IT
Tasks
1. Write a MATLAB code to verify the formula
a2-b2 = (a+b)(a-b)
2. What is the function of the commands, ceil and floor ? Use
MATLAB help to learn these commands and then apply them
to a constant of 4.5
3. Use MATLAB to find the area of a circle whose radius is 4