MATH 308, Summer Examples in MATLAB
|
|
- Charleen Chapman
- 5 years ago
- Views:
Transcription
1 MATH 308, Summer 2016 Examples in MATLAB % % %% % %% % Plotting a function % % %% % %% % %% % %% % %% % %% % %% % figure(1) clear t % Anonymous Functions u7=@(t) 0198*exp(-08590*t) *exp(-29142*t) + (1/45)*sin(5*t); uu7=@(t) (1/45)*sin(5*t); uuu7=@(t) 0198*exp(-08590*t) *exp(-29142*t) ; fplot(u7,[0,4*pi]); fplot(uu7,[0,4*pi], - ); fplot(uuu7,[0,4*pi], - ); title([ Function u(t)= 0198*exp(-08590t)+ + (1/45)*sin(5*t) ]);
2 figure(2) % Inline Functions syms x fplot(xˆ2,[-3 0], b ) fplot(x,[0 3], b ) figure(4) f t * y ˆ2; dirfield2(f,-2:02:2,-2:02:2) title([ Direction Field of dy/dt=f(x,y)= tyˆ2 ]); hold off figure(2 ) clear all for c=1:3 u=@(t) tˆ2 + c ; fplot(u,[0,3]); title([ Function u(t,c)= tˆ2 + c ]);
3 % % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %%%% % % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% %% % %% % %% % Plotting a Direction Field % % %% % %% % %% % %% % %% % %% %%%% % %%% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% %% figure(3) %% Z =S(T,Y) [T,Y]=meshgrid(-2:02:3,-1:02:2); S=exp(-T)-2*Y; %% Using an inline defined function quiver(t,y, ones(size(s)),s), axis tight figure(4) %% Using an anonymous defined function f t*y ˆ2; dirfield2(f,-2:02:2,-2:02:2) function dirfield2(f,tval,yval) % dirfield(f, t1:dt:t2, y1:dy:y2) % plot direction field for first order ODE y = f(t,y) % using t-values from t1 to t2 with spacing of dt % using y-values from y1 to t2 with spacing of dy % % f is anonymous function, % or the name of an m-file with quotes
4 % % Example: y = ty 2 % Show direction field for t in [-2,2], y in [-2,2], use % spacing of 2 for both t and y: % % f t*y ˆ2; % dirfield2(f,-2:02:2,-2:02:2) [tm,ym]=meshgrid(tval,yval); dt = tval(2) - tval(1); dy = yval(2) - yval(1); fv = vectorize(f); if isa(f, function_handle ) fv = eval(fv); yp=feval(fv,tm,ym); s = 1/max(1/dt,abs(yp)/dy)*035; h = ishold; quiver(tval,yval,s,s*yp,0, r ); ; quiver(tval,yval,-s,-s*yp,0, r ); if h else hold off axis([tval(1)-dt/2,tval()+dt/2,yval(1)-dy/2,yval()+dy/2]) % % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %%%% % % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% %% % %% % %% % Finding the zeros of a function % % %% % %% % %% % %% % %% % %% %% % %%% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% %% clear all lb = 0; % Set a lower bound for the function ub = 45; % Set an upper bound for the function N=900 ; % Number of reference points x = NaN*ones(N,1); % Initializes x starting_points=linspace(lb,ub,n); for i=1:n % Look for the zeros in the function s current window but we are interested only for the zeros of f on [0, 40] x(i)=fzero(@(x) 5*sin(19*x)+21*sin(91*x), starting_points(i)); x_unique=x(diff(x)>1e-12) x_final=zeros(size(x_unique)); x_final(1)= x_unique(1); for i=2:size(x_unique) if abs(x_unique(i) - x_unique(i-1)) < x_final(i)=0; else x_final(i)=x_unique(i); x_final y_final=zeros(size(x_unique)); fun 5*sin(19*x)+21*sin(91*x);
5 fplot(fun,[0,45]); plot(x_final, y_final, * ) title([ Zeros of f(x)=5*sin(19x)+21sin(91x), ]);
6 %%% %%%%%% %%% Plotting a Direction Field %%% %%%%%% %%% %%Define the function [(-1/2)*Y(1) + Y(2); -Y(1) - (1/2)*Y(2)]; %To generate the phase portrait, we need to compute the derivatives y1 %and y2 at t on a grid over the range of values for y1 and y2 we are %interested in We will plot the derivatives as a vector at each %(y1, y2) which will show us the initial direction from each point %We will examine the solutions over the range -2 < y1 < 8, and % -2 < y2 < 2 for y2, and create a grid of points y1 = linspace(-3,3,10); y2 = linspace(-3,3,10); % y3= linspace(-3,3,10); % creates two matrices one for all the x-values on the grid, and one for % all the y-values on the grid Note that x and y are matrices of the same % size and shape, in this case 20 rows and 20 columns [x,y] = meshgrid(y1,y2); %[x,y,z] = meshgrid(y1,y2, y3); size(x); size(y); u = zeros(size(x)); v = zeros(size(x)); t=0; for i = 1:numel(x) Yprime = f(t,[x(i); y(i)]); u(i) = Yprime(1); v(i) = Yprime(2); quiver(x,y,u,v, r ); figure(gcf) %quiver3(x,y,z,u,v,w, r ); figure(gcf) xlabel( x_1 ); ylabel( x_2 ); %zlabel( x_3 ) title([ Phase Space x_1-x_2 ]);
7 % % %% % %% % %% Phase portraits of a system of 2D or 3D-ODEs %% % %% % %% % %%%% % % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% %%% % %% % %% % % %% % %% % Y1 = (-1/2) Y1 + Y2 %% %% % %% % %% % %%% %%% % %%% % %% % %% % %% % Y2 = - Y1 - (1/2)Y2 %% % %% % %% % %% % %% % %% % %%% % %% % %% % %% % Defining the velocity vector field %% % %% % %% % %% % %% [(-1/2)*Y(1) + Y(2); -Y(1) - (1/2)*Y(2)]; y1 = linspace(-3,3,10); y2 = linspace(-3,3,10); %y3 = linspace(-3,3,10); % creates two matrices one for all the x-values on the grid, and one for % all the y-values on the grid Note that x and y are matrices of the same % size and shape, in this case 20 rows and 20 columns [x,y] = meshgrid(y1,y2); %[x,y,z] = meshgrid(y1,y2, y3); size(x); size(y); %size(z); u = zeros(size(x)); v = zeros(size(x)); %w = zeros(size(z)); % we can use a single loop over each element to compute the derivatives at % each point (y1, y2) t=0; for i = 1:numel(x) Yprime = f(t,[x(i); y(i)]); %Yprime = f(t,[x(i); y(i); z(i)]); u(i) = Yprime(1); v(i) = Yprime(2); %w(i) = Yprime(3); quiver(x,y,u,v, r ); figure(gcf) %quiver3(x,y,z,u,v,w, r ); figure(gcf) xlabel( x_1 ) ylabel( x_2 ) %zlabel( x_3 )
8 for xinit = -3:1:3 ; for yinit = -3:1:3 ; %for zinit = -2:1:2 ; [ts,ys] = ode45(f,[-10,50],[xinit;yinit]); %[ts,ys] = ode45(f,[-10,50],[xinit;yinit;zinit]); plot(ys(:,1),ys(:,2)) %plot3(ys(:,1),ys(:,2),ys(:,3)) plot(ys(1,1),ys(1,2), bo ) %plot3(ys(1,1),ys(1,2),ys(1,3), bo ) plot(ys(,1),ys(,2), ks ) %plot3(ys(,1),ys(,2),ys(,3), ks ) %axis([ ]); % axis([ ]); %axis([ ]); title([ Phase Space x_1 - x_2 ]); %title([ Phase Space x_1 - x_2 - x_3 ]); set(gca, Color, blue ); set(gcf, color, [0 0 1]) hold off
9 % % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% %% % % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% %% % % % % % % % % % % % % % % Mechanical Oscillations % % % % % % % % % % % % % % % % % % % % % % % % % % % % Examples % % % % % % % % % % % % % % % % % % % % % % % % Example 55 % % % % % % % % % % % % % % % % figure(1) clear t R delta omega R=05270; delta= 28198; omega=6; u1=@(t) R*cos(omega*t - delta); fplot(u1,[0,2*pi]); title([ Function u(t)= R*cos(omega*t - delta) ]); % % % % % % % % % % Example 56 % % % % % % % % % % % % % % % % figure(2) clear t u2=@(t) *exp(-24792*t) *exp( *t) ; fplot(u2,[0,2*pi]); title([ Function u(t)= *exp(-24792*t) *exp( *t) ]); axis([0 2*pi ])
10 % % % % % % % % % % Example 57 % % % % % % % % % % % % % % % % figure(3) clear t -(1/2)*exp(-6*t) - 2*t*exp(-6*t) ; fplot(u3,[0,2*pi]); title([ Function u(t)= -(1/2)exp(-6t) - 2texp(-6t); critical axis([0 2*pi ]) damping ]);
11 % % % % % % % % % % Example 58 % % % % % % % % % % % % % % % % figure(4) clear t u4=@(t) 0502*exp(-5*t/2)*cos( (sqrt(119)/2)*t ) ; fplot(u4,[0,pi]); title([ Function u(t)= -0502eˆ{-5t/2 }cos(54*t - 323) ]);
Introduction to MATLAB
Introduction to MATLAB The language of technical computing AM 581 Computational Laboratory Department of Applied Mechanics, IIT Madras MATLAB: technical computing language & interactive environment for
More informationMAT 275 Laboratory 3 Numerical Solutions by Euler and Improved Euler Methods (scalar equations)
MATLAB sessions: Laboratory 3 1 MAT 275 Laboratory 3 Numerical Solutions by Euler and Improved Euler Methods (scalar equations) In this session we look at basic numerical methods to help us understand
More informationMAT 275 Laboratory 3 Numerical Solutions by Euler and Improved Euler Methods (scalar equations)
MAT 275 Laboratory 3 Numerical Solutions by Euler and Improved Euler Methods (scalar equations) In this session we look at basic numerical methods to help us understand the fundamentals of numerical approximations.
More informationLogical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression.
What is the answer? >> Logical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression. The finite(x)is true for all finite numerical
More informationEE 350. Continuous-Time Linear Systems. Recitation 1. 1
EE 350 Continuous-Time Linear Systems Recitation 1 Recitation 1. 1 Recitation 1 Topics MATLAB Programming Basic Operations, Built-In Functions, and Variables m-files Graphics: 2D plots EE 210 Review Branch
More informationMATH 2221A Mathematics Laboratory II
MATH A Mathematics Laboratory II Lab Assignment 4 Name: Student ID.: In this assignment, you are asked to run MATLAB demos to see MATLAB at work. The color version of this assignment can be found in your
More informationIntroduction to MATLAB
Introduction to MATLAB Violeta Ivanova, Ph.D. Office for Educational Innovation & Technology violeta@mit.edu http://web.mit.edu/violeta/www Topics MATLAB Interface and Basics Calculus, Linear Algebra,
More informationINTERNATIONAL EDITION. MATLAB for Engineers. Third Edition. Holly Moore
INTERNATIONAL EDITION MATLAB for Engineers Third Edition Holly Moore 5.4 Three-Dimensional Plotting Figure 5.8 Simple mesh created with a single two-dimensional matrix. 5 5 Element,5 5 The code mesh(z)
More informationIntroduction to MATLAB
Introduction to MATLAB Violeta Ivanova, Ph.D. MIT Academic Computing violeta@mit.edu http://web.mit.edu/violeta/www/iap2006 Topics MATLAB Interface and Basics Linear Algebra and Calculus Graphics Programming
More informationComputing Fundamentals Plotting
Computing Fundamentals Plotting Salvatore Filippone salvatore.filippone@uniroma2.it 2014 2015 (salvatore.filippone@uniroma2.it) Plotting 2014 2015 1 / 14 Plot function The basic function to plot something
More informationGraphics in MATLAB. Responsible teacher: Anatoliy Malyarenko. November 10, Abstract. Basic Plotting Commands
Graphics in MATLAB Responsible teacher: Anatoliy Malyarenko November 10, 2003 Contents of the lecture: Two-dimensional graphics. Formatting graphs. Three-dimensional graphics. Specialised plots. Abstract
More informationPlotting - Practice session
Plotting - Practice session Alessandro Fanfarillo - Salvatore Filippone fanfarillo@ing.uniroma2.it May 28th, 2013 (fanfarillo@ing.uniroma2.it) Plotting May 28th, 2013 1 / 14 Plot function The basic function
More informationSignals and Systems Profs. Byron Yu and Pulkit Grover Fall Homework 1
18-290 Signals and Systems Profs. Byron Yu and Pulkit Grover Fall 2018 Homework 1 This homework is due in class on Thursday, September 6, 9:00am. Instructions Solve all non-matlab problems using only paper
More informationEE 301 Signals & Systems I MATLAB Tutorial with Questions
EE 301 Signals & Systems I MATLAB Tutorial with Questions Under the content of the course EE-301, this semester, some MATLAB questions will be assigned in addition to the usual theoretical questions. This
More informationDATA PLOTTING WITH MATLAB
DATA PLOTTING WITH MATLAB Prof. Marco Pilotti marco.pilotti@ing.unibs.it Dr. Giulia Valerio giulia.valerio@ing.unibs.it Giulia Valerio 7Marzo 2014 1 1. WHY MATLAB? WHY MATLAB? Matlab is a high-level programming
More informationIntroduction to MATLAB LAB 1
Introduction to MATLAB LAB 1 1 Basics of MATLAB MATrix LABoratory A super-powerful graphing calculator Matrix based numeric computation Embedded Functions Also a programming language User defined functions
More informationJason Yalim. Here we perform a few tasks to ensure a clean working environment for our script.
Table of Contents Initialization... 1 Part One -- Computation... 1 Part Two -- Plotting... 5 Part Three -- Plotting Incorrectly... 7 Part Four -- Showing Output Adjacent to Code... 8 Part Five -- Creating
More informationEric W. Hansen. The basic data type is a matrix This is the basic paradigm for computation with MATLAB, and the key to its power. Here s an example:
Using MATLAB for Stochastic Simulation. Eric W. Hansen. Matlab Basics Introduction MATLAB (MATrix LABoratory) is a software package designed for efficient, reliable numerical computing. Using MATLAB greatly
More informationBasic MATLAB. Getting MATLAB (for MIT students) Creating matrices and vectors. Some operation of matrices/vectors.
Basic MATLAB Getting MATLAB (for MIT students) http://web.mit.edu/matlab/www/home.html Creating matrices and vectors >> rowvector = [0 20] rowvector = 0 20 >> columnvector = [0; 20] columnvector = 0 20
More informationMATLAB Tutorial. Mohammad Motamed 1. August 28, generates a 3 3 matrix.
MATLAB Tutorial 1 1 Department of Mathematics and Statistics, The University of New Mexico, Albuquerque, NM 87131 August 28, 2016 Contents: 1. Scalars, Vectors, Matrices... 1 2. Built-in variables, functions,
More informationBasic Graphs. Dmitry Adamskiy 16 November 2011
Basic Graphs Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 16 November 211 1 Plot Function plot(x,y): plots vector Y versus vector X X and Y must have the same size: X = [x1, x2 xn] and Y = [y1, y2,, yn] Broken
More information1. Register an account on: using your Oxford address
1P10a MATLAB 1.1 Introduction MATLAB stands for Matrix Laboratories. It is a tool that provides a graphical interface for numerical and symbolic computation along with a number of data analysis, simulation
More informationMechanical Engineering Department Second Year (2015)
Lecture 7: Graphs Basic Plotting MATLAB has extensive facilities for displaying vectors and matrices as graphs, as well as annotating and printing these graphs. This section describes a few of the most
More informationNumerical Methods in Engineering Sciences
Numerical Methods in Engineering Sciences Lecture 1: Brief introduction to MATLAB Pablo Antolin pablo.antolinsanchez@unipv.it October 29th 2013 How many of you have used MATLAB before? How many of you
More informationGlobal Variables. ˆ Unlike local variables, global variables are available to all functions involved.
Global Variables ˆ Unlike local variables, global variables are available to all functions involved. ˆ Use global to declare x as global. ˆ For example, the universal constant, say,. 1 ˆ However, it is
More informationIntroduction to Octave/Matlab. Deployment of Telecommunication Infrastructures
Introduction to Octave/Matlab Deployment of Telecommunication Infrastructures 1 What is Octave? Software for numerical computations and graphics Particularly designed for matrix computations Solving equations,
More informationEuler s Methods (a family of Runge- Ku9a methods)
Euler s Methods (a family of Runge- Ku9a methods) ODE IVP An Ordinary Differential Equation (ODE) is an equation that contains a function having one independent variable: The equation is coupled with an
More information2.0 MATLAB Fundamentals
2.0 MATLAB Fundamentals 2.1 INTRODUCTION MATLAB is a computer program for computing scientific and engineering problems that can be expressed in mathematical form. The name MATLAB stands for MATrix LABoratory,
More informationIntroduction to Simulink
Introduction to Simulink There are several computer packages for finding solutions of differential equations, such as Maple, Mathematica, Maxima, MATLAB, etc. These systems provide both symbolic and numeric
More informationFall 2015 Math 337. Basic MatLab
Fall 215 Math 337 Basic MatLab MatLab is a powerful software created by MathWorks, which is used extensively in mathematics, engineering, and the sciences. It has powerful numerical and graphic capabilities,
More informationMATLAB. Input/Output. CS101 lec
MATLAB CS101 lec24 Input/Output 2018-04-18 MATLAB Review MATLAB Review Question ( 1 2 3 4 5 6 ) How do we access 6 in this array? A A(2,1) B A(1,2) C A(3,2) D A(2,3) MATLAB Review Question ( 1 2 3 4 5
More informationBasic Simulation Lab with MATLAB
Chapter 3: Generation of Signals and Sequences 1. t = 0 : 0.001 : 1; Generate a vector of 1001 samples for t with a value between 0 & 1 with an increment of 0.001 2. y = 0.5 * t; Generate a linear ramp
More informationENGG1811 Computing for Engineers Week 11 Part C Matlab: 2D and 3D plots
ENGG1811 Computing for Engineers Week 11 Part C Matlab: 2D and 3D plots ENGG1811 UNSW, CRICOS Provider No: 00098G1 W11 slide 1 More on plotting Matlab has a lot of plotting features Won t go through them
More informationA Tutorial on Matlab Ch. 3 Programming in Matlab
Department of Electrical Engineering University of Arkansas A Tutorial on Matlab Ch. 3 Programming in Matlab Dr. Jingxian Wu wuj@uark.edu OUTLINE 2 Plotting M-file Scripts Functions Control Flows Exercises
More informationSTAT/MATH 395 A - PROBABILITY II UW Winter Quarter Matlab Tutorial
STAT/MATH 395 A - PROBABILITY II UW Winter Quarter 2016 Néhémy Lim Matlab Tutorial 1 Introduction Matlab (standing for matrix laboratory) is a high-level programming language and interactive environment
More informationMATLAB Fundamentals. Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University
MATLAB Fundamentals Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University Reference: 1. Applied Numerical Methods with MATLAB for Engineers, Chapter 2 &
More informationMath 375 Natalia Vladimirova (many ideas, examples, and excersises are borrowed from Profs. Monika Nitsche, Richard Allen, and Stephen Lau)
Natalia Vladimirova (many ideas, examples, and excersises are borrowed from Profs. Monika Nitsche, Richard Allen, and Stephen Lau) January 24, 2010 Starting Under windows Click on the Start menu button
More informationHello Earth! A grounded introduction to Matlab. Frederik J Simons. Christopher Harig. Adam C. Maloof Princeton University
Hello Earth! A grounded introduction to Matlab Frederik J Simons Christopher Harig Adam C. Maloof Princeton University (Enter teacher) i 2 Something canny Matlab can do i 3 200 400 600 800 1000 100 200
More informationPart VI. Scientific Computing in Python. Alfredo Parra : Scripting with Python Compact Max-PlanckMarch 6-10,
Part VI Scientific Computing in Python Compact Course @ Max-PlanckMarch 6-10, 2017 63 Doing maths in Python Standard sequence types (list, tuple,... ) Can be used as arrays Can contain different types
More informationUNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER
UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER BENC 2113 DENC ECADD 2532 ECADD LAB SESSION 6/7 LAB
More informationODE IVP. An Ordinary Differential Equation (ODE) is an equation that contains a function having one independent variable:
Euler s Methods ODE IVP An Ordinary Differential Equation (ODE) is an equation that contains a function having one independent variable: The equation is coupled with an initial value/condition (i.e., value
More informationME422 Mechanical Control Systems Matlab/Simulink Hints and Tips
Cal Poly San Luis Obispo Mechanical Engineering ME Mechanical Control Systems Matlab/Simulink Hints and Tips Ridgely/Owen, last update Jan Building A Model The way in which we construct models for analyzing
More informationMATLAB BASICS. < Any system: Enter quit at Matlab prompt < PC/Windows: Close command window < To interrupt execution: Enter Ctrl-c.
MATLAB BASICS Starting Matlab < PC: Desktop icon or Start menu item < UNIX: Enter matlab at operating system prompt < Others: Might need to execute from a menu somewhere Entering Matlab commands < Matlab
More informationMMAE-540 Adv. Robotics and Mechatronics - Fall 2007 Homework 4
MMAE-54 Adv. Robotics and Mechatronics - Fall 27 Homework 4 Assigned Wednesday Sep. 9th Due Wednesday Sept. 26th.5 Trajectory for t = s.5 Trajectory for t = 2 s.5.5 -.5 -.5 - - -.5 -.5-2 - 2-2 -.5 Trajectory
More informationA Guide to Using Some Basic MATLAB Functions
A Guide to Using Some Basic MATLAB Functions UNC Charlotte Robert W. Cox This document provides a brief overview of some of the essential MATLAB functionality. More thorough descriptions are available
More informationPART 1 PROGRAMMING WITH MATHLAB
PART 1 PROGRAMMING WITH MATHLAB Presenter: Dr. Zalilah Sharer 2018 School of Chemical and Energy Engineering Universiti Teknologi Malaysia 23 September 2018 Programming with MATHLAB MATLAB Environment
More informationIntroduction to GNU-Octave
Introduction to GNU-Octave Dr. K.R. Chowdhary, Professor & Campus Director, JIETCOE JIET College of Engineering Email: kr.chowdhary@jietjodhpur.ac.in Web-Page: http://www.krchowdhary.com July 11, 2016
More informationMATLAB Laboratory 09/23/10 Lecture. Chapters 5 and 9: Plotting
MATLAB Laboratory 09/23/10 Lecture Chapters 5 and 9: Plotting Lisa A. Oberbroeckling Loyola University Maryland loberbroeckling@loyola.edu L. Oberbroeckling (Loyola University) MATLAB 09/23/10 Lecture
More informationMS6021 Scientific Computing. TOPICS: Python BASICS, INTRO to PYTHON for Scientific Computing
MS6021 Scientific Computing TOPICS: Python BASICS, INTRO to PYTHON for Scientific Computing Preliminary Notes on Python (v MatLab + other languages) When you enter Spyder (available on installing Anaconda),
More informationIntroduction to Matlab. Summer School CEA-EDF-INRIA 2011 of Numerical Analysis
Introduction to Matlab 1 Outline What is Matlab? Matlab desktop & interface Scalar variables Vectors and matrices Exercise 1 Booleans Control structures File organization User defined functions Exercise
More informationMatlab Tutorial: Basics
Matlab Tutorial: Basics Topics: opening matlab m-files general syntax plotting function files loops GETTING HELP Matlab is a program which allows you to manipulate, analyze and visualize data. MATLAB allows
More informationBSM510 Numerical Analysis
BSM510 Numerical Analysis Introduction and Matlab Fundamentals Manar Mohaisen Department of EEC Engineering Lecture Content Introduction to MATLAB 2 Introduction to MATLAB MATLAB 3 Scalars >> x = 5; x
More informationINTRODUCTION TO NUMERICAL ANALYSIS
INTRODUCTION TO NUMERICAL ANALYSIS Cho, Hyoung Kyu Department of Nuclear Engineering Seoul National University 0. MATLAB USAGE 1. Background MATLAB MATrix LABoratory Mathematical computations, modeling
More informationDirection Fields; Euler s Method
Direction Fields; Euler s Method It frequently happens that we cannot solve first order systems dy (, ) dx = f xy or corresponding initial value problems in terms of formulas. Remarkably, however, this
More informationChapter 2. MATLAB Fundamentals
Chapter 2. MATLAB Fundamentals Choi Hae Jin Chapter Objectives q Learning how real and complex numbers are assigned to variables. q Learning how vectors and matrices are assigned values using simple assignment,
More informationMatrix Transformations The position of the corners of this triangle are described by the vectors: 0 1 ] 0 1 ] Transformation:
Matrix Transformations The position of the corners of this triangle are described by the vectors: [ 2 1 ] & [4 1 ] & [3 3 ] Use each of the matrices below to transform these corners. In each case, draw
More information1 >> Lecture 4 2 >> 3 >> -- Graphics 4 >> Zheng-Liang Lu 184 / 243
1 >> Lecture 4 >> 3 >> -- Graphics 4 >> Zheng-Liang Lu 184 / 43 Introduction ˆ Engineers use graphic techniques to make the information easier to understand. ˆ With graphs, it is easy to identify trends,
More informationComputational lab on complex numbers
Computational lab on complex numbers SAK, physics 1140 March 15, 2010 1 Objective To learn how to use MATLAB as an advanced calculator and gain familiarity with complex numbers using MATLAB. 2 Introduction
More informationTOPIC 6 Computer application for drawing 2D Graph
YOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM TOPIC 6 Computer application for drawing 2D Graph Plotting Elementary Functions Suppose we wish
More informationUser-Defined Function
ENGR 102-213 (Socolofsky) Week 11 Python scripts In the lecture this week, we are continuing to learn powerful things that can be done with userdefined functions. In several of the examples, we consider
More informationRobotics SUMMER 2004 Assignment #4. (SOLUTION) Instructor: Jose Mireles Jr.
Robotics SUMMER 2004 Assignment #4. (SOLUTION) Instructor: Jose Mireles Jr. 1. Reproduce the simulation in Example 3.4-1 of Lewis et al. That is, for the two link planar elbow arm, simulate in MATLAB the
More informationIntroduction to MATLAB Practical 1
Introduction to MATLAB Practical 1 Daniel Carrera November 2016 1 Introduction I believe that the best way to learn Matlab is hands on, and I tried to design this practical that way. I assume no prior
More informationINTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX
INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX 1) Objective The objective of this lab is to review how to access Matlab, Simulink, and the Communications Toolbox, and to become familiar
More informationGRAPHICS AND VISUALISATION WITH MATLAB
GRAPHICS AND VISUALISATION WITH MATLAB UNIVERSITY OF SHEFFIELD CiCS DEPARTMENT Des Ryan & Mike Griffiths September 2017 Topics 2D Graphics 3D Graphics Displaying Bit-Mapped Images Graphics with Matlab
More informationFF505/FY505 Computational Science. MATLAB Graphics. Marco Chiarandini
FF505/FY505 Computational Science MATLAB Marco Chiarandini (marco@imada.sdu.dk) Department of Mathematics and Computer Science (IMADA) University of Southern Denmark Outline 1. 2D Plots 3D Plots 2 Outline
More informationGetting Started with MATLAB
Getting Started with MATLAB Math 315, Fall 2003 Matlab is an interactive system for numerical computations. It is widely used in universities and industry, and has many advantages over languages such as
More informationTime-Saving Hint: Use the up-arrow on your keyboard to cycle through old commands.
Introduction to Matlab by Dr. Adam Larios It is important to type all of the code as you go along. You will learn it better this way: your brain will make connections based on what your hands are physically
More informationGetting Started with Matlab
Chapter Getting Started with Matlab The computational examples and exercises in this book have been computed using Matlab, which is an interactive system designed specifically for scientific computation
More informationEGR 102 Introduction to Engineering Modeling. Lab 05B Plotting
EGR 102 Introduction to Engineering Modeling Lab 05B Plotting 1 Overview Plotting in MATLAB 2D plotting ( ezplot(), fplot(), plot()) Formatting of 2D plots 3D plotting (surf(), mesh(), plot3()) Formatting
More informationMath 7 Elementary Linear Algebra PLOTS and ROTATIONS
Spring 2007 PLOTTING LINE SEGMENTS Math 7 Elementary Linear Algebra PLOTS and ROTATIONS Example 1: Suppose you wish to use MatLab to plot a line segment connecting two points in the xy-plane. Recall that
More informationA Very Brief Introduction to Matlab
A Very Brief Introduction to Matlab by John MacLaren Walsh, Ph.D. for ECES 63 Fall 26 October 3, 26 Introduction To MATLAB You can type normal mathematical operations into MATLAB as you would in an electronic
More informationAMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA
AMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA MATLAB (short for MATrix LABoratory) is a very useful piece of software for numerical
More informationWhat is MATLAB? It is a high-level programming language. for numerical computations for symbolic computations for scientific visualizations
What is MATLAB? It stands for MATrix LABoratory It is developed by The Mathworks, Inc (http://www.mathworks.com) It is an interactive, integrated, environment for numerical computations for symbolic computations
More informationThis is a basic tutorial for the MATLAB program which is a high-performance language for technical computing for platforms:
Appendix A Basic MATLAB Tutorial Extracted from: http://www1.gantep.edu.tr/ bingul/ep375 http://www.mathworks.com/products/matlab A.1 Introduction This is a basic tutorial for the MATLAB program which
More informationPlotting using Matlab. Vytautas Astromskas
Plotting using Matlab Vytautas Astromskas Contents 1 Manipulating a plot using GUI 2 2 Manipulating a plot using command line 4 3 Adding multiple lines to the same plot 5 4 Logarithmic axes 6 5 Plotting
More informationECE 3793 Matlab Project 2
Spring 07 What to Turn In: ECE 3793 Matlab Project DUE: 04/7/07, :59 PM Dr. Havlice Mae one file that contains your solution for this assignment. It can be an MS WORD file or a PDF file. Mae sure to include
More information12 whereas if I terminate the expression with a semicolon, the printed output is suppressed.
Example 4 Printing and Plotting Matlab provides numerous print and plot options. This example illustrates the basics and provides enough detail that you can use it for typical classroom work and assignments.
More informationAssignment 02 (Due: Monday, February 1, 2016)
Assignment 02 (Due: Monday, February 1, 2016) CSCE 155N 1 Lab Objectives Improve your understanding of arrays and array operations Differentiate array operators and matrix operators Create, access, modify,
More information2. Plotting in MATLAB
2. Plotting in MATLAB MATLAB provides several methods for plotting the graphs of functions and more general curves. The easiest to use is what we will call EZ plotting, since it uses the command ezplot
More informationMatLab Just a beginning
MatLab Just a beginning P.Kanungo Dept. of E & TC, C.V. Raman College of Engineering, Bhubaneswar Introduction MATLAB is a high-performance language for technical computing. MATLAB is an acronym for MATrix
More informationAPPM 2460 PLOTTING IN MATLAB
APPM 2460 PLOTTING IN MATLAB. Introduction Matlab is great at crunching numbers, and one of the fundamental ways that we understand the output of this number-crunching is through visualization, or plots.
More informationHomework Set #2-3, Math 475B
Homework Set #2-3, Math 475B Part I: Matlab In the last semester you learned a number of essential features of MATLAB. 1. In this instance, you will learn to make 3D plots and contour plots of z = f(x,
More informationQuick MATLAB Syntax Guide
Quick MATLAB Syntax Guide Some useful things, not everything if-statement Structure: if (a = = = ~=
More informationIntroduction to MATLAB: Graphics
Introduction to MATLAB: Graphics Eduardo Rossi University of Pavia erossi@eco.unipv.it September 2014 Rossi Introduction to MATLAB Financial Econometrics - 2014 1 / 14 2-D Plot The command plot provides
More informationArmstrong Atlantic State University Engineering Studies MATLAB Marina 2D Plotting Primer
Armstrong Atlantic State University Engineering Studies MATLAB Marina D Plotting Primer Prerequisites The D Plotting Primer assumes knowledge of the MATLAB IDE, MATLAB help, arithmetic operations, built
More informationCSE 123. Plots in MATLAB
CSE 123 Plots in MATLAB Easiest way to plot Syntax: ezplot(fun) ezplot(fun,[min,max]) ezplot(fun2) ezplot(fun2,[xmin,xmax,ymin,ymax]) ezplot(fun) plots the expression fun(x) over the default domain -2pi
More information16.06/16.07 Matlab/Simulink Tutorial
Massachusetts Institute of Technology 16.06/16.07 Matlab/Simulink Tutorial Version 1.0 September 2004 Theresa Robinson Nayden Kambouchev 1 Where to Find More Information There are many webpages which contain
More informationClasses 7-8 (4 hours). Graphics in Matlab.
Classes 7-8 (4 hours). Graphics in Matlab. Graphics objects are displayed in a special window that opens with the command figure. At the same time, multiple windows can be opened, each one assigned a number.
More informationPhysics 251 Laboratory Introduction to Spreadsheets
Physics 251 Laboratory Introduction to Spreadsheets Pre-Lab: Please do the lab-prep exercises on the web. Introduction Spreadsheets have a wide variety of uses in both the business and academic worlds.
More informationNatSciLab - Numerical Software Introduction to MATLAB
Outline 110112 NatSciLab - Numerical Software Introduction to MATLAB Onur Oktay Jacobs University Bremen Spring 2010 Outline 1.m files 2 Programming Branching (if, switch) Loops (for, while) 3 Anonymous
More informationPC-MATLAB PRIMER. This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens.
PC-MATLAB PRIMER This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens. >> 2*3 ans = 6 PCMATLAB uses several lines for the answer, but I ve edited this to save space.
More informationHow to learn MATLAB? Some predefined variables
ECE-S352 Lab 1 MATLAB Tutorial How to learn MATLAB? 1. MATLAB comes with good tutorial and detailed documents. a) Select MATLAB help from the MATLAB Help menu to open the help window. Follow MATLAB s Getting
More informationIntroduction to Matlab. SAMSI Undergraduate Workshop May 15, 2006
Introduction to Matlab SAMSI Undergraduate Workshop May 15, 2006 1 The things you need to know about Matlab How arrays and matrices are stored How to use operators on arrays and matrices How to write a.m
More informationELEN E3084: Signals and Systems Lab Lab II: Introduction to Matlab (Part II) and Elementary Signals
ELEN E384: Signals and Systems Lab Lab II: Introduction to Matlab (Part II) and Elementary Signals 1 Introduction In the last lab you learn the basics of MATLAB, and had a brief introduction on how vectors
More informationMatlab Tutorial 1: Working with variables, arrays, and plotting
Matlab Tutorial 1: Working with variables, arrays, and plotting Setting up Matlab First of all, let's make sure we all have the same layout of the different windows in Matlab. Go to Home Layout Default.
More informationPowerPoints organized by Dr. Michael R. Gustafson II, Duke University
Part 1 Chapter 2 MATLAB Fundamentals PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
More informationA Brief Introduction to MATLAB
A Brief Introduction to MATLAB MATLAB (Matrix Laboratory) is an interactive software system for numerical computations and graphics. As the name suggests, MATLAB was first designed for matrix computations:
More informationGrace days can not be used for this assignment
CS513 Spring 19 Prof. Ron Matlab Assignment #0 Prepared by Narfi Stefansson Due January 30, 2019 Grace days can not be used for this assignment The Matlab assignments are not intended to be complete tutorials,
More informationStokes Modelling Workshop
Stokes Modelling Workshop 14/06/2016 Introduction to Matlab www.maths.nuigalway.ie/modellingworkshop16/files 14/06/2016 Stokes Modelling Workshop Introduction to Matlab 1 / 16 Matlab As part of this crash
More informationME 4943 Course Project - Part I
ME 4943 Course Project - Part I Numerical Implementation of the Source Panel Method by Jeffrey A. Kornuta Mechanical Engineering Louisiana State University October 9, 27 1 Contents 1 Verification of Algorithm
More information