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

Report
Engr/Math/Physics 25
Tutorial-1
Intro Videos
Build HW File
Bruce Mayer, PE
Licensed Electrical & Mechanical Engineer
[email protected]
Engineering/Math/Physics 25: Computational Methods
1
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
First ENGR25 Tutorial
 MATLAB Video Tutorials
• http://www.mathworks.com/academia/stud
ent_center/tutorials/launchpad.html
– http://www.mathworks.com/videos/matlab/gettin
g-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/getti
ng-started-with-simulink.html (3.5 min min)
Engineering/Math/Physics 25: Computational Methods
2
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
First ENGR25 Tutorial
 MATLAB Video Tutorials
• http://www.mathworks.com/academia/stud
ent_center/tutorials/launchpad.html
– http://www.mathworks.com/videos/matlab/creati
ng-a-basic-plot-interactively.html (6 min)
Engineering/Math/Physics 25: Computational Methods
3
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
HW File MSWord Starting Point
Engineering/Math/Physics 25: Computational Methods
4
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
Example Problem 1-21
 Plot This Function
T  6 ln t  7e
0.2t
• Where
– T  Temperature (°C)
– t  time (minutes)
• For: 1  t  3
Engineering/Math/Physics 25: Computational Methods
5
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
3x3 from ENGR43
 For The DC Linear Circuits We Will
need to Solve Systems Of Algebraic
Equations
R2
2.2 kΩ
I2
R3 1.2 kΩ
1.5 kΩ
I3 Rx
R1
2.7 kΩ
7 mA
RL
13V
I1
IL
1.8 kΩ
Engineering/Math/Physics 25: Computational Methods
6
12V1  9V2  4V3  8
 4V1  16V2  V3  0
 2V1  4V2  6V3  20
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
First ENGR25 Tutorial
– Additional Videos Useful in the future
 http://www.mathworks.com/videos/matlab/importingdata-from-files.html (HW5, 7min)
 http://www.mathworks.com/products/simulink/demos.
html?BB=1 (SimuLink)
 http://www.mathworks.com/videos/simulink/getting-started-withsimulink.html (4 min)
 http://www.mathworks.com/videos/simulink/visualizingsimulation-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)
Engineering/Math/Physics 25: Computational Methods
7
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
Additional Useful Videos
http://www.mathworks.com/products/matlab/demos.html
Engineering/Math/Physics 25: Computational Methods
8
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
3x3 from ENGR43
 For The DC Linear Circuits We Will
need to Solve Systems Of Algebraic
Equations
R2
2.2 kΩ
I2
R3 1.2 kΩ
1.5 kΩ
I3 Rx
R1
2.7 kΩ
7 mA
RL
13V
I1
IL
1.8 kΩ
Engineering/Math/Physics 25: Computational Methods
9
12V1  9V2  4V3  8
 4V1  16V2  V3  0
 2V1  4V2  6V3  20
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
Day1 demo Script
Engineering/Math/Physics 25: Computational Methods
10
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
DeskTop Recovery
to UnScramble the DeskTop
Engineering/Math/Physics 25: Computational Methods
11
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
All Done for Today
Please Try
Using
MATLAB
in 3906A
 Let’s do MQ-00b
Engineering/Math/Physics 25: Computational Methods
12
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
 Let’s do MQ-00b
 Let’s do MQ-00b
Engineering/Math/Physics 25: Computational Methods
13
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
Example Problem 1-21
 Plot This Function
T  6 ln t  7e
0.2t
• Where
– T  Temperature (°C)
– t  time (minutes)
• For: 1  t  3
Engineering/Math/Physics 25: Computational Methods
14
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
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
Temp vs time
-6
-6.5
-7
T (deg C)
>>
>>
>>
>>
>>
>>
>>
-7.5
-8
-8.5
-9
Engineering/Math/Physics 25: Computational Methods
15
1
1.2
1.4
1.6
1.8
2
t (Sec)
2.2
2.4
2.6
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
2.8
3
Engr/Math/Physics 25
Appendix
Bruce Mayer, PE
Licensed Electrical & Mechanical Engineer
[email protected]
Engineering/Math/Physics 25: Computational Methods
16
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
Example Demo Session
>> %Use MATLAB As Calculator
>> (7+11)*2.5
>> 17*19
ans =
ans =
45
323
>> L = 14.4
>> 77/19 -4.3
L =
ans =
14.4000
-0.2474
>> W = 13.3
>> 64^(1/3) + 32^0.2
ans =
W =
13.3000
6
>> Area = L*W
Area =
Engineering/Math/Physics 25: Computational Methods
17
191.5200
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
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
Engineering/Math/Physics 25: Computational Methods
18
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
Prob 1-22 Plot
Engineering/Math/Physics 25: Computational Methods
19
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
Problem 1-22
-6
Temperature (°C)
-6.5
-7
-7.5
-8
-8.5
-9
1
1.2
1.4
1.6
1.8
2
2.2
time (min)
Engineering/Math/Physics 25: Computational Methods
20
2.4
2.6
2.8
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt
3
System, Directory, File Cmnds
Command
Description
pwd Displays the current directory
Changes the current directory to
dirname
Removes the directory dirname from
rmpath dirname
the search path.
cd dirname
Lists the MATLAB-specific files found in
the current working directory. Most data
what
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
Engineering/Math/Physics 25: Computational Methods
21
Bruce Mayer, PE
[email protected] • ENGR-25_MATLAB_OverView-1.ppt

similar documents