Instructor'S Document: Practice

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

INSTRUCTORS DOCUMENT

Day 1
Cleve Moler invented it.
Explain how images are stored in computer.
Image processing and Vibration example

Command window, workspace, command history, current directory

Clc, clear command, help topic


Defining variable
Simple arithmetic operations of scalars. Complex numbers 3+2*I, 3e-2

Create a vector, use size, sin, sind, sqrt


Colon operator (1:3:18) 1:2:1000 then use semicolon to suppress output
create a matrix
Practice

X = [1:4;5:8;9:12] x(2,3)
C = x(2,3); c
X(2,3) = 97; x
X(2,2) = 123; x
Ab = (2,2) = 123

X(4,5)
X(4,5) = 456

X(2,[1 3])
X([2 1], 2)
X([2,1,2],[3,1,1,2])
X(2:-1:1, 3:-1:1)
X(end,2)
X(2,end)
X(1,end-1)
X(1,1:2:end)
X(1:end,1) = 45
X(1:end,2:3) = -2

Combining Matrices
a = [1 2; 3 4;5 6]; b = [4 5;3 6;7 8]; c = [a b;b a]
a1 = [1 1 1;1 1 1]; a2,a3 [a1 a2 a3]
[a1;a2;a3]
B1 = [1;1] b2 = [2 2;2 2] b3 = [3 3 3;3 3 3]
[b1 b2 b3] [b1 b2 b3 b1]
Transpose
Practice session

Plotting
A = (1:10)^2 plot(a)
Figure A = (-10:10)^2 plot(a)
T = -10:10, b = t.^2
Figure plot(t,b)
X1 = 0:0.1:2*pi; y1 = sin(x1)
X2 = pi/2:0.1:3*pi; y2 = cos(x2)
Plot(x1,y1,x2,y2)
Figure plot(x1,y1,r,x2,y2,k:)
Help plot
Figure(1) plot (t,b,mo)
Hold on, hold of
Title(sine and cosine plot);
Xlabel, ylabel
Legend(sine, cosine)
Axis(-2 12 -1.5 1.5) {first two inputs are left and right limit, other two bottom and
top limit}
Subplot(3,2,1) plots 3x2 grid of plots at location 1

F(x) = e^-(x-a)^2 / b
Create 1x2 sublot, set b = 1 and plot for several values of a, then a =1,
plot several values of b

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy