Basic MATLAB. Matlab Post-processer Graphics Analytical solution comparisons.

Slides:



Advertisements
Similar presentations
MATLAB – A Computational Methods By Rohit Khokher Department of Computer Science, Sharda University, Greater Noida, India MATLAB – A Computational Methods.
Advertisements

Calculus Review GLY Slope Slope = rise/run =  y/  x = (y 2 – y 1 )/(x 2 – x 1 ) Order of points 1 and 2 not critical Points may lie in any quadrant:
Maths for Computer Graphics
Introduction to Matlab Tutorial for CS4MN3/SE3X03 Wen Yu McMaster University.
EGR106 Week 5 MATLAB FILES Two Dimensional Plots Multiple Plots Plot Formatting Homework.
Lecture 7 Sept 19, 11 Goals: two-dimensional arrays (continued) matrix operations circuit analysis using Matlab image processing – simple examples Chapter.
Lecture 6 Sept 15, 09 Goals: two-dimensional arrays matrix operations circuit analysis using Matlab image processing – simple examples.
Week 3 Last week Vectors Array Addressing Mathematical Operations Array Multiplication and Division Identity Matrix Inverse of a Matrix Element by Element.
MATLAB Basic. Basic Data Elements The basic elements that MATLAB uses are matrices To form a matrix: Enter : A=[ ; ; ;
2005/8Matrices-1 Matrices. 2005/8Matrices-2 A Matrix over a Field F (R or C) m rows n columns size: m×n ij-entry: a ij  F (ij-component)
Introduction to MATLAB MECH 300H Spring Starting of MATLAB.
Module 6 Matrices & Applications Chapter 26 Matrices and Applications I.
What is MATLAB ? MATrix LABratory –Originally, it was a front-end to FORTRAN matrix routines developed in the U. of New Mexico and Stanford –Today.
Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4.
What is Matlab? A software environment for interactive numerical computations Examples: –Matrix computations and linear algebra –Solving nonlinear equations.
Martin Ellison University of Warwick and CEPR Bank of England, December 2005 Introduction to MATLAB.
GNU/Qt Octave Rohin Kumar Y, Dept. of Physics & Astro Physics, University of Delhi.
1 "A picture is worth a thousand words." Graphical representation is useful for: Error detection - you can locate outliers in a dataset, program bugs,
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
Different Types of Fields to Describe the Earth. Anisotropy, heterogeneity SEM of shale (Josh et al., 2012)
Section 7.2 & 7.3.  Row x Column ROW COLUMN a x + b y = c d x + e y = f AB X.
A Brief Introduction to Matlab Laila Guessous Dept. of Mechanical Engineering Oakland University.
INTRODUCTION TO MATLAB LAB# 01
Class Opener:. Identifying Matrices Student Check:
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Rotation matrices 1 Constructing rotation matricesEigenvectors and eigenvalues 0 x y.
MATLAB – PT1 The purpose of this workshop is to get you started and to have fun with MATLAB! Let’s talk a little and decide on what we will be covering.
10.3 Systems of Linear Equations: Matrices. A matrix is defined as a rectangular array of numbers, Column 1Column 2 Column jColumn n Row 1 Row 2 Row 3.
EXAMPLE 1 Represent figures using matrices Write a matrix to represent the point or polygon. a. Point A b. Quadrilateral ABCD.
Files: By the end of this class you should be able to: Prepare for EXAM 1. create an ASCII file describe the nature of an ASCII text Use and describe string.
How to Multiply Two Matrices. Steps for Matrix Multiplication 1.Determine whether the matrices are compatible. 2.Determine the dimensions of the product.
8.2 Operations With Matrices
Calculus Review GLY Slope Slope = rise/run =  y/  x = (y 2 – y 1 )/(x 2 – x 1 ) Order of points 1 and 2 not critical, but keeping them together.
1.7 Linear Independence. in R n is said to be linearly independent if has only the trivial solution. in R n is said to be linearly dependent if there.
Intro to Matlab Rogelio Long September 3, How to access MyDesktop Log in with your utep id and password.
CS100A, Fall 1998, Lecture 201 CS100A, Fall 1998 Lecture 20, Tuesday Nov 10 More Matlab Concepts: plotting (cont.) 2-D arrays Control structures: while,
Notes Over 4.2 Finding the Product of Two Matrices Find the product. If it is not defined, state the reason. To multiply matrices, the number of columns.
4.1 An Introduction to Matrices Katie Montella Mod. 6 5/25/07.
Precalculus Section 14.1 Add and subtract matrices Often a set of data is arranged in a table form A matrix is a rectangular.
EEE 242 Computer Tools for Electrical Engineering
How to use MATLAB (using M-files) Double click this icon To start Matlab 6.5.
1 Matrix Math ©Anthony Steed Overview n To revise Vectors Matrices.
Algebr a 3.5x + 2 = 44m + b. Algebr a 3.5x + 2 = 44m + b Solve for x in terms of m,b.
13.4 Product of Two Matrices
Matlab Workshop 9/22/2018.
StatLab Matlab Workshop
Multiplying Matrices.
Use of Mathematics using Technology (Maltlab)
StatLab Workshop: Intro to Matlab for Data Analysis and Statistical Modeling 11/29/2018.
Basic MATLAB.
Matrices Elements, Adding and Subtracting
MATLAB How to use (using M-files)
CSCI N317 Computation for Scientific Applications Unit 1 – 5 MATLAB
Communication and Coding Theory Lab(CS491)
CS 175 Project in AI Discussion -- matlab
An example of using euler.m
Multiplying Matrices.
Transformations.
Introduction to Matlab
3.6 Multiply Matrices.
Systems of linear equations:
1.8 Matrices.
Matrix A matrix is a rectangular arrangement of numbers in rows and columns Each number in a matrix is called an Element. The dimensions of a matrix are.
1.8 Matrices.
Multiplying Matrices.
Importing Excel Data & Exporting Data to Excel
Multiplying Matrices.
Matrix Multiplication Sec. 4.2
Multiplying Matrices.
Chapter 7 Section 7.2 Matrices.
Presentation transcript:

Basic MATLAB

Matlab Post-processer Graphics Analytical solution comparisons

Vectors >> a=[ ] a = >> a' ans =

Autofilling and addressing Vectors > a=[1:0.2:3]' a = >> a(2:3) ans =

xy Plots >> x=[ ]; >> y=[ ]; >> plot(x,y)

Matrices >> b=[ ; ] b = >> b' ans =

Matrices >> b=2.2*ones(4,4) b =

Reshape >> a=[1:9] a = >> bsquare=reshape(a,3,3) bsquare = >>

Load and if a = load(‘filename’); (semicolon suppresses echo) if(1) … else … end

For for i = 1:10 … end

Grad [dhdx,dhdy]=gradient(h);

BMP Output bsq=rand(100,100); %bmp1 output e(:,:,1)=1-bsq; %r e(:,:,2)=1-bsq; %g e(:,:,3)=ones(100,100); %b imwrite(e, 'junk.bmp','bmp'); image(imread('junk.bmp')) axis('equal')

Contours h=[…]; contour(h) [C,H]=contour(h) Clabel(C,H)

Contours (load data, prepare matrix) rho=load('rho_frame0012_subs00.dat') p_vector=rho/3 rows=100 columns=20 for j=1:columns j for i=1:rows p(i,j)=p_vector(j+(i-1)*columns); %Get rid of '0 pressure' solids that dominate pressure field if p(i,j)==0 p(i,j)=NaN; end

Contours [C,H]=contour(p) clabel(C,H) axis equal

Quiver (vector plots) >> scale=10; >> d=rand(100,4); >> quiver(d(:,1),d(:,2),d(:,3),d(:,4),scale)

Quiver (and Quiver3) uv_vector=load('u_frame0012_subs00.dat') rows=100 columns=20 for j=1:columns j for i=1:rows u(i,j)=uv_vector(j+(i-1)*20,1); v(i,j)=uv_vector(j+(i-1)*20,2); end hold on quiver(u,v)

Streamline [Stream]= stream2(u,v,5,100) streamline(Stream)

Streamlines [Stream]= stream2(u,v,[1:20],100*ones(20,1)); streamline(Stream) (This is for streamlines starting at y = 100 from x = 1 to 20 along the x axis. Different geometries will require different starting points.)