matlab no1

405 views

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
405
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

matlab no1

  1. 1. Signals and Systems Lab Course Grading Criteria Attendance……….10% Lab Tasks…………..30% Project………………20% Lab exam..………...20% Viva…………………..20% CECOS College of Engineering and IT March – July 2012
  2. 2. Accessing lab server  To download manuals and software from lab server  Goto : start >> Run >> write dsp-server CECOS College of Engineering and IT March – July 2012
  3. 3. Lab No.01 Getting Familiar with MATLAB Designed by : Dawar Awan dawar@cecos.edu.pk CECOS College of Engineering and IT March – July 2012
  4. 4. 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 CECOS College of Engineering and IT March – July 2012
  5. 5. MATLAB  add-on toolboxes provide application specific commands  The power lye in rich libraries and toolboxes for almost every field of engineering CECOS College of Engineering and IT March – July 2012
  6. 6. 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 CECOS College of Engineering and IT March – July 2012
  7. 7. MATLAB Interface Current directory Command window Workspace Command history CECOS College of Engineering and IT March – July 2012
  8. 8. Variables  User defined variables   CECOS College of Engineering and IT (“^” , is used for power) March – July 2012
  9. 9. Variables  Suppressing output (use semi colon at the end of instruction)  Value of variable CECOS College of Engineering and IT March – July 2012
  10. 10. 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 CECOS College of Engineering and IT March – July 2012
  11. 11. Variable arithmetic 2+3*4^2 <== exponent has the highest precedence ==> 2 + 3*16 <== then multiplication operator ==> 2 + 48 <== then addition operator ==> 50 CECOS College of Engineering and IT March – July 2012
  12. 12. Predefined trigonometric functions Function Meaning Example =========================================================== sin sine sin(pi) = 0.0 cos cosine cos(pi) = -1.0 tan tangent tan(pi/4) = 1.0 asin arcsine asin(1)= 1.5708 acos arccosine acos(1)= 0.0 atan arctangent atan(1)= 0.7854 exp exponential exp(1.0) = 2.7183 log natural logarithm log(2.7183) = 1.0 log10 logarithm base 10 log10(100.0) = 2.0 =========================================================== The arguments of trigonometric functions are given in radians CECOS College of Engineering and IT March – July 2012
  13. 13. Practice  Verify that sin2(x)+ cos2(x) = 1  For arbitrary x, the MATLAB code will be: CECOS College of Engineering and IT March – July 2012
  14. 14. MATLAB Help  www.mathworks.com  >> help  >> help <command name> CECOS College of Engineering and IT March – July 2012
  15. 15. 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 CECOS College of Engineering and IT March – July 2012

×