MATLAB LABORATORY SESSION

Slides:



Advertisements
Similar presentations
Beginning Programming for Engineers
Advertisements

Lecture (4) Plotting & Programming (1) Eng. Osama Talaat 1.
Matlab Graphics S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: 2D Graphics.
1.3 ARRAYS, FILES, AND PLOTS + FOURIER SERIES BY MR. Q.
Introduction to Matlab. I use Matlab for: Data analysis Data plotting Image Analysis Also – Simulations (solving odes/pdes/finite element methods) – Minimisations,
Introduction to Matlab Jianguo Wang CSSCR September 2009.
Warm Up Graph the lines on the same grid and identify the point where they meet. 1. y=2x-2 2. y=x+1.
SUNY-New Paltz Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz “Lecture 5”
BRIAN D. HAHN AND DANIEL T. VALENTINE THIRD EDITION Essential MATLAB® for Engineers and Scientists.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
1 Tips for solving Project 1 Reactor SO 3 SO 2 +O 2.
Example 1 Find the intercepts of the graph of. Finding Intercepts 2 1 y = x – = x – = x 10 = x STEP 1 Let 0 and solve for x to find the.
INTRODUCTION TO MATLAB LAB# 01
Introduction To this point MATLAB has been used to answer questions with a numeric value ▫Variables are assigned specific values ▫Answers are numbers MATLAB.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
Introduction to MATLAB Session 5 Simopekka Vänskä, THL 2010.
Introduction to Matlab Module #9 Page 1 Introduction to Matlab Module #9 – Simulink Topics 1.Simulink Textbook Reading Assignments Practice Problems.
An Introduction to Straight Line Graphs Drawing straight line graphs from their equations. Investigating different straight line graphs.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
9.3 – Linear Equation and Inequalities 1. Linear Equations 2.
Program design and algorithm development We will consider the design of your own toolbox to be included among the toolboxes already available with your.
Recap Functions with No input OR No output Determining The Number of Input and Output Arguments Local Variables Global Variables Creating ToolBox of Functions.
What is a ZERO of a function? Morgan White Airline High School Algebra I Students, you should move on to the next slide in order to learn an introduction.
Introduction to Matlab Engr. Mian Shahzad Iqbal LAB NO.2
“Moh’d Sami” AshhabSummer 2008University of Jordan MATLAB By (Mohammed Sami) Ashhab University of Jordan Summer 2008.
Session III Plotting in MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU MATLAB Tutorials.
MA2213 Lecture 10 ODE. Topics Importance p Introduction to the theory p Numerical methods Forward Euler p. 383 Richardson’s extrapolation.
Mathematical Applications By Matlab 3 rd Day Dr. Wael Khedr CSI Dept.
Introduction to LTspice IV
Graphing Linear Equations
ECE 1304 Introduction to Electrical and Computer Engineering
Introduction to Matlab
Introduction to MATLAB
Computer Application in Engineering Design
Practice. Practice Practice Practice Practice r = X = 20 X2 = 120 Y = 19 Y2 = 123 XY = 72 N = 4 (4) 72.
Signals in Matlab Matlab as a name stands for Matrix Laboratory.
Graphs Earth Science.
Lecture 25.
Introduction to MATLAB
Ch3 Graphics Overview of Plotting Editing Plots
Solution of Nonlinear Equations
Lecture 25: Exploring data
Standard Form I can identify intercepts from an equation.
Other Kinds of Arrays Chapter 11
MATLAB DENC 2533 ECADD LAB 9.
Introduction to Matlab
(Mohammed Sami) Ashhab
User Defined Functions
Graphing Linear Equations in Standard Form
All About Graphs Graphs and charts are great because they communicate information visually – using a picture!
Equalities Inequalities < Is less than = Equals- is the same as
Lecture 10 2D plotting & curve fitting
Part (a) Keep in mind that dy/dx is the SLOPE! We simply need to substitute x and y into the differential equation and represent each answer as a slope.
CSCI N317 Computation for Scientific Applications Unit 1 – 5 MATLAB
We’ve plotted points on graphs before… • •
Find the slope between the following points. Use (y2 – y1)/(x2 – x1)
What do you think will be the values of y?
Introduction to MATLAB
MATLAB Introduction MATLAB can be thought of as a powerful graphing calculator but with a lot more buttons! It is also a programming language, commands.
Section 9.4 – Solving Differential Equations Symbolically
Graphing Systems of Equations
WHY DO WE USE GRAPHS? Graphs help us visualize numerical data.
Find the slope between the following points. Use (y2 – y1)/(x2 – x1)
Symbols, Variables, and Types of Sentences used in Algebra.
2 Step Equations Grade 6 Algebra Unit.
Where do these graphs intersect
Graphical Relationships
Graphing Linear Equations
Bellwork Graph on a number line 1.) x < 4 2.) y ≥ -2 3.) x ≤ 0
Presentation transcript:

MATLAB LABORATORY SESSION SEE1012: Introduction to Electrical Engineering MATLAB LABORATORY SESSION

HELP To access MATLAB help or documentation >> help Or To access help on specific topic e.g. sin(x) >> help sin >> doc sin

PLOT MATLAB provides a number of plots Getting help on plot >> doc plot >> doc subplot >> doc plot3 >> doc pie >> doc polar >> doc bar After the CANCER project, the next innovation was the SPICE program. SPICE stands for Simulation Program with Integrated Circuit Emphasis. This new acronym was created from the fact that many of the components being placed on the new integrated circuit were becoming smaller than the discrete components themselves. With this in mind, the SPICE creators wanted to save money by not having to manufacture chips to test the circuits. The next logical step was to let a computer do the testing for them. By not building the physical circuit, the designers can save a lot of time and money.

PLOT MATLAB provides a number of plots Single plot e.g. >> x=0:pi/50:4*pi >> plot(x,sin(x)) After the CANCER project, the next innovation was the SPICE program. SPICE stands for Simulation Program with Integrated Circuit Emphasis. This new acronym was created from the fact that many of the components being placed on the new integrated circuit were becoming smaller than the discrete components themselves. With this in mind, the SPICE creators wanted to save money by not having to manufacture chips to test the circuits. The next logical step was to let a computer do the testing for them. By not building the physical circuit, the designers can save a lot of time and money.

PLOT Double line on single graph e.g. >> x=0:pi/50:4*pi >> plot(x,sin(x),x,cos(x)) After the CANCER project, the next innovation was the SPICE program. SPICE stands for Simulation Program with Integrated Circuit Emphasis. This new acronym was created from the fact that many of the components being placed on the new integrated circuit were becoming smaller than the discrete components themselves. With this in mind, the SPICE creators wanted to save money by not having to manufacture chips to test the circuits. The next logical step was to let a computer do the testing for them. By not building the physical circuit, the designers can save a lot of time and money.

PLOT Multiple separate graphs e.g. >> x=0:pi/50:4*pi >> subplot(1,2,1) >> plot(x,sin(x)) >> subplot(1,2,2) >> plot(x,cos(x)) After the CANCER project, the next innovation was the SPICE program. SPICE stands for Simulation Program with Integrated Circuit Emphasis. This new acronym was created from the fact that many of the components being placed on the new integrated circuit were becoming smaller than the discrete components themselves. With this in mind, the SPICE creators wanted to save money by not having to manufacture chips to test the circuits. The next logical step was to let a computer do the testing for them. By not building the physical circuit, the designers can save a lot of time and money.

PLOT 3 dimensional plot e.g. plot of a helix >> t = 0:pi/50:10*pi; >> plot3(sin(t),cos(t),t) >> grid on axis square After the CANCER project, the next innovation was the SPICE program. SPICE stands for Simulation Program with Integrated Circuit Emphasis. This new acronym was created from the fact that many of the components being placed on the new integrated circuit were becoming smaller than the discrete components themselves. With this in mind, the SPICE creators wanted to save money by not having to manufacture chips to test the circuits. The next logical step was to let a computer do the testing for them. By not building the physical circuit, the designers can save a lot of time and money.

PLOT MATLAB can draw a sphere >> sphere >> axis equal After the CANCER project, the next innovation was the SPICE program. SPICE stands for Simulation Program with Integrated Circuit Emphasis. This new acronym was created from the fact that many of the components being placed on the new integrated circuit were becoming smaller than the discrete components themselves. With this in mind, the SPICE creators wanted to save money by not having to manufacture chips to test the circuits. The next logical step was to let a computer do the testing for them. By not building the physical circuit, the designers can save a lot of time and money.

PLOT MATLAB can draw other shapes as well. >> [x,y] = meshgrid(-16:1.0:16); >> z = sqrt(x.^2 + y.^2 + 5000); >> surf(z) >> shading interp After the CANCER project, the next innovation was the SPICE program. SPICE stands for Simulation Program with Integrated Circuit Emphasis. This new acronym was created from the fact that many of the components being placed on the new integrated circuit were becoming smaller than the discrete components themselves. With this in mind, the SPICE creators wanted to save money by not having to manufacture chips to test the circuits. The next logical step was to let a computer do the testing for them. By not building the physical circuit, the designers can save a lot of time and money.

Solving Equations MATLAB provides many ways of solving equations Example Lets try solving two equations y=x2 and y=x+4 Get help on ‘solve’ >> doc solve

Solving Equations To solve the two equations >> S = solve('y-x^2','y-x-4’)

Solving Equations To solve the two equations >> s = solve('y-x^2','y-x-4’) This will flag an error. Why? >> s = solve('y-x.^2','y-x-4’) >> s.x >> x=double(s.x) >> y=double(s.y)

Solving Equations Lets see the intersection of the two graphs >> x=-2:.1:3 >> plot(x,x.^2,x,x+4)

Differentiation MATLAB is able to differentiate an equation Let y=x4+2x3+3x2+4x+5 >> y=[1 2 3 4 5] >> diff(y)

FUNCTION Function can be created using m-files. The name of the file must be similar to the name of the function. Create a new file Save the file as not_a_function.m in MATLAB subdirectory

Content of not_a_function Content of not_a_function.m file subplot(2,2,1) plot(x,sin(x)) subplot(2,2,2) plot(x,sin(x+pi/2)) subplot(2,2,3) plot(x,cos(x)) subplot(2,2,4) plot(x,cos(x+pi/2))

FUNCTION From the MATLAB workspace type : >> x=0:pi/50:4*pi; >> not_a_function

FUNCTION A function can be created by naming a file similar to the name of the function. Example To create a function, open not_a_function.m Save the file as myfunction.m in MATLAB subdirectory

Content of myfunction.m file function myfunction(x) % This is my first function in MATLAB % I hope I will use it a lot later % % See you then subplot(2,2,1) … plot(x,cos(x+pi/2))

FUNCTION From the MATLAB workspace type : >> clear x >> x=0:pi/50:4*pi; >> myfunction(x)

Symbolic Toolbox To use symbolic toolbox, type >> help syms To declare s as a variable >> syms s

Symbolic Toolbox To differentiate a function in s >> d=diff(3*s^2+4*s+5) To integrate a function in s >> i=int(d)

THE END