[email protected] engr-25_matlab_overview-1.ppt 1 bruce mayer, pe engineering/math/physics...

21
[email protected] • ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical & Mechanical Engineer [email protected] Engr/Math/Physics 25 Tutorial-1 Intro Videos Build HW File

Upload: hubert-benson

Post on 02-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt1

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

Bruce Mayer, PELicensed Electrical & Mechanical Engineer

[email protected]

Engr/Math/Physics 25

Tutorial-1Intro VideosBuild HW File

Page 2: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt2

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

First ENGR25 Tutorial

MATLAB Video Tutorials• http://www.mathworks.com/academia/stude

nt_center/tutorials/launchpad.html– http://www.mathworks.com/videos/matlab/

getting-started-with-matlab.html (6 min)– http://www.mathworks.com/videos/matlab/writin

g-a-matlab-program.html (6 min)

– http://www.mathworks.com/videos/matlab/using-basic-plotting-functions.html (6 min)

– http://www.mathworks.com/videos/simulink/getting-started-with-simulink.html (3.5 min min)

Page 3: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt3

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

First ENGR25 Tutorial

MATLAB Video Tutorials• http://www.mathworks.com/academia/stude

nt_center/tutorials/launchpad.html– http://www.mathworks.com/videos/matlab/creati

ng-a-basic-plot-interactively.html (6 min)

Page 4: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt4

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

HW File MSWord Starting Point

Page 5: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt5

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

Example Problem 1-21

Plot This Function

tetT 2.07ln6 • Where

– T Temperature (°C)– t time (minutes)

• For: 1 t 3

Page 6: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt6

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

3x3 from ENGR43

For The DC Linear Circuits We Will need to Solve Systems Of Algebraic Equations

20642

0164

84912

321

321

321

VVV

VVV

VVV2.2 kΩ 1.2 kΩ1.5 kΩ

2.7 kΩ

1.8 kΩ

R1

R2 R3Rx

RL13V

7 mA

I1

I2 I3

IL

Page 7: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt7

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

First ENGR25 Tutorial– Additional Videos Useful in the future

http://www.mathworks.com/videos/matlab/importing-data-from-files.html (HW5, 7min)

http://www.mathworks.com/products/simulink/demos.html?BB=1 (SimuLink) http://www.mathworks.com/videos/simulink/getting-started-with-s

imulink.html (4 min)

http://www.mathworks.com/videos/simulink/visualizing-simulation-results.html (4 min)

HW Presentation Save MATLAB work to MSWord file• Trapezoid area, 3x3 Eqn System, cosh

calculation, plot y = ln(t+.02)·sin(1.3t)

Page 8: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt8

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

Additional Useful Videoshttp://www.mathworks.com/products/matlab/demos.html

Page 9: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt9

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

3x3 from ENGR43

For The DC Linear Circuits We Will need to Solve Systems Of Algebraic Equations

20642

0164

84912

321

321

321

VVV

VVV

VVV2.2 kΩ 1.2 kΩ1.5 kΩ

2.7 kΩ

1.8 kΩ

R1

R2 R3Rx

RL13V

7 mA

I1

I2 I3

IL

Page 10: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt10

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

Day1 demo Script

Page 11: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt11

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

DeskTop Recoveryto UnScramble the DeskTop

Page 12: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt12

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

All Done for Today

Please TryUsing

MATLABin 3906A

Let’s do MQ-00b

Page 13: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt13

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

Let’s do MQ-00b

Let’s do MQ-00b

Page 14: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt14

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

Example Problem 1-21

Plot This Function

tetT 2.07ln6 • Where

– T Temperature (°C)– t time (minutes)

• For: 1 t 3

Page 15: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt15

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

Prob 1-21

>> t = [1:.01:3];>> T = 6*log(t) - 7*exp(0.2*t);>> plot(t,T, 'LineWidth', 3)>> xlabel('t (Sec)')>> ylabel('T (deg C)')>> title('Temp vs time')>> grid

1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3-9

-8.5

-8

-7.5

-7

-6.5

-6

t (Sec)

T (

deg

C)

Temp vs time

Page 16: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt16

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

Bruce Mayer, PELicensed Electrical & Mechanical Engineer

[email protected]

Engr/Math/Physics 25

Appendix

Page 17: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt17

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

Example Demo Session>> %Use MATLAB As Calculator

>> 17*19

ans =

323

>> 77/19 -4.3

ans =

-0.2474

>> 64^(1/3) + 32^0.2

ans =

6

>> (7+11)*2.5

ans =

45

>> L = 14.4

L =

14.4000

>> W = 13.3

W =

13.3000

>> Area = L*W

Area =

191.5200

Page 18: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt18

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

Prob 1-21 Command Script

From the Command Window

>> t = [1:0.02:3];

>> T = 6*log(t) - 7*exp(0.2*t);

>> plot(t,T), xlabel('time (min)'),ylabel('Temperature (°C)'), title('Problem 1-21'), grid

Page 19: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt19

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

Prob 1-22 Plot

Page 20: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt20

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3-9

-8.5

-8

-7.5

-7

-6.5

-6

time (min)

Te

mp

era

ture

(°C

)

Problem 1-22

Page 21: BMayer@ChabotCollege.edu ENGR-25_MATLAB_OverView-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical

[email protected] • ENGR-25_MATLAB_OverView-1.ppt21

Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods

System, Directory, File Cmnds Command Description

pwd Displays the current directory

cd dirname Changes the current directory to dirname

rmpath dirname Removes the directory dirname from the search path.

what

Lists the MATLAB-specific files found in the current working directory. Most data files and other non-MATLAB files are not listed. Use dir to get a list of all files

what dirname Lists the MATLAB-specific files in directory dirname