COMP 116: Introduction to Scientific Programming Lecture 6: Scripts and publishing, Creating matrices.

Slides:



Advertisements
Similar presentations
Microsoft FrontPage Monday January 28, The Basic FrontPage Setup.
Advertisements

Introduction to MATLAB The language of Technical Computing.
COMP 116: Introduction to Scientific Programming Lecture 37: Final Review.
Introduction to Matlab
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
MATLAB – What is it? Computing environment / programming language Tool for manipulating matrices Many applications, you just need to get some numbers in.
CS231A Matlab Tutorial Philip Lee Winter Overview  Goals › Introduction to Matlab › Matlab Snippets › Basic image manipulations › Helpful Matlab.
Maths for Computer Graphics
Intro MATLAB: Special Purpose Computer Program Optimized to perform engineering and scientific calculations Implements the MATLAB programming language.
Introduction to Matlab By: Dr. Maher O. EL-Ghossain.
The Microsoft Office Suite. Microsoft Office Versions  Microsoft Office  Microsoft Office 95  Microsoft Office 97  Microsoft Office 98  Microsoft.
COMP101 – Exploring Multimedia and Internet Computing LA2 (Thu 14:00 – 16:50) TA: Jackie Lo.
MATLAB TUTORIAL Dmitry Drutskoy Some material borrowed from the departmental MATLAB info session by Philippe Rigollet Kevin Wayne.
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
Matlab tutorial course Lesson 2: Arrays and data types
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
Introduction to MATLAB Zongqiang Liao Research Computing Group UNC-Chapel Hill.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
Introduction to Matlab 1. Outline: What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators Plotting Flow Control Using of M-File Writing.
Introduction to MATLAB. Windows in MATLAB Command Window – where you enter data, run MATLAB code, and display results Command History - displays a log.
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
Lecture # 3 HTML and Arrays. Today Questions: From notes/reading/life? From Lab # 2 – Preview of Lab # 2 1.Introduce: How do you make a Web Page?: HTML.
1 CSC 121 Computers and Scientific Thinking David Reed Creighton University HTML and Web Pages.
CSE123 Lecture 5 Arrays and Array Operations. Definitions Scalars: Variables that represent single numbers. Note that complex numbers are also scalars,
Matlab Workshop 1/10/07 Lesson 1: Matlab as a graphing calculator.
INTRODUCTION TO MATLAB LAB# 01
COMP 116: Introduction to Scientific Programming Lecture 5: Plotting, Scripts and publishing.
CREATING WEB PAGES Using…More HTML code! My First \ Web Page.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
MAE 1202: AEROSPACE PRACTICUM An Introduction to MATLAB: Part 2 Mechanical and Aerospace Engineering Department Florida Institute of Technology Developed.
LEARNING HTML PowerPoint #1 Cyrus Saadat, Webmaster.
Lecture 2 - Matlab Introduction CVEN 302 June 5, 2002.
Introduction to HTML. HTML Introduction HTML – Hypertext Markup Language are the instructions that tell a browser how to lay out the information (text,
Computational Boot Camp HTML Mike Schaffer. 8/23/2002 (MES) HTML What is HTML? HTML stands for HyperText Markup Language HTML is the language for publishing.
Matlab Basics FIN250f: Lecture 3 Spring 2010 Grifths Web Notes.
Octave. Getting Started Arithmetic is as usual: – What would (a-V)(V-1)V be for a=0.1 and V=-56? – Multiplication is *, division is /
Introduction to Matlab. Outline:  What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display.
Introduction to Matlab. What is Matlab? A software environment for interactive numerical computations Examples:  Matrix computations and linear algebra.
Matlab Screen  Command Window  type commands  Current Directory  View folders and m-files  Workspace  View program variables  Double click on a.
MATLAB Lecture Two Tuesday 5 July Chapter 3.
Chapter 2 Creating Arrays Legend: MATLAB command or syntax : Blue MATLAB command OUTPUT : LIGHT BLUE.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
Introduction to Matlab
Introduction to MATLAB Zongqiang Liao Research Computing Group UNC-Chapel Hill.
HTML HyperText Markup Language. Text Files An array of bytes stored on disk Each element of the array is a text character A text editor is a user program.
Digital Image Processing. Converting between Data Classes The general syntax is B = data_class_name (A) Where data_class_name is one of the names defined.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Open Office Writer Introduction AOSS _ Course material AOSS Master training workshop Singapore 2007.
CS100A, Fall 1998, Lecture 201 CS100A, Fall 1998 Lecture 20, Tuesday Nov 10 More Matlab Concepts: plotting (cont.) 2-D arrays Control structures: while,
An Introduction to Programming in Matlab Emily Blumenthal
NoViC, Dept. of Mechanical Eng Acoustics Lab., NoViC 1. Download Matlab 2.
How to use MATLAB (using M-files) Double click this icon To start Matlab 6.5.
Introduction to Matlab. Outline:  What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators.
Introduction to Matlab
Introduction to Matlab
Introduction to Programming for Mechanical Engineers (ME 319)
Introduction to Matlab
Matlab Workshop 9/22/2018.
MATLAB How to use (using M-files) Double click this icon
MATH 493 Introduction to MATLAB
MATLAB How to use (using M-files) Double click this icon
Lecture 2 Introduction to MATLAB
Digital Image Processing
CSE107 Matlab Introduction
MATLAB How to use (using M-files)
Announcements P3 due today
Microsoft Word Software
Matrices and Determinants
Presentation transcript:

COMP 116: Introduction to Scientific Programming Lecture 6: Scripts and publishing, Creating matrices

Recap Very Very useful commands ◦ doc  e.g. >> doc rand ◦ help ◦ lookfor Creating arrays ◦ x=linspace(0,2*pi,100); Plotting ◦ >>plot(x, sin(x), ’:r’) ◦ >>plot(x, sin(x) ’-og’)

Scripts Create

Write the script Write the commands

Save to current folder

Run the script Script should be in the current folder To run test.m >>test

Comments in scripts

Exercise 1 Write a script that plots a square with dotted red edges/lines

Publishing Output your scripts as HTML or Microsoft Word Files

Cells in Scripts Structure your code using cells ng-code-rapidly-with-cells-matlab-video- tutorial.html

Creating a publishable script Same as regular script except for the % command, which acts like a comment, but is also used to separate commands into groups (cells, sections) for publication purposes. % Sine curves: The ups and downs of life; % Create Data x=linspace(0,2*pi,100); y=sin(x); % Now plot x vs. y: The Basic solid blue plot plot( x, y); % The dotted red line plot(x,y,’:r’); % Green line with green squares plot(x,y,’sg’);

Publish Example To publish the script in HTML >> publish( 'pub_circle', 'html' ) Or in MS Word >> publish( 'pub_circle', ‘doc' ) Note: You can also publish from the script Editor window using the File →Publish menu item, defaults to HMTL

Exercise 1I Write and publish a script that plots ◦ A triangle with solid blue lines/edges ◦ A square with dotted red lines/edges Use cells and comments in the script so that the published report can be read and understood by others.

Text Markup for Publishing Bold Text ◦ Use * * ◦*comment 1* Italics ◦ Use _ _ ◦_comment 2_ Monospacing ◦ Use | | ◦|comment 3| Hyperlinked Text ◦ Bulleted Text Items ◦* Item 1 ◦* Item 2 Numbered Items ◦# Item 1 ◦# Item 2 Note: You can also use the Editor window to do text markup using the Cell →Insert Text Markup → menu item

Matrices Each element of the matrix is a variable (memory location) To create this 3x4 matrix ◦ y=[ ; ; ] An array is a 1xn matrix

Matrix operations m=[3 6 4; 1 2 3] Matrix-Scalar operations >>m=m*2 >>n=m-3 Matrix-matrix operations (must be same size) >>p=m+n >>q=m.*n (use. for multiplication and division)

Creating matrices >>rand(m,n) mxn matrix of random numbers >>zeros(m,n) all zeros >>ones(m,n) all ones >>eye(m,n) identity matrix >>diag(v) diagonal matrix >>doc to get detailed documentation e.g. >>doc diag

Matrix indexing m=[ ; ; ] Individual elements ◦ m(2,3) ◦ m(2,1)=7 Rows ◦ m(2,:)=[ ] ◦ m(3,:) Columns ◦ m(:,2) ◦ m(:,3)=[1; 9; 7] Block ◦ m(2:3,2:end)

Assignment 1 Images as matrices