SlideShare a Scribd company logo
MATLAB/Simulink tutorial
ECEN 2060
MATLAB/Simulink
• MathWorks tools for technical computing and simulations, widely used
across various engineering and science disciplines
• MATLAB
 Programming language and interactive environment well suited for
computing, algorithms, data processing and visualization
• Simulink
 Environment for graphical, model-based simulation of dynamic systems
• Available in all computer labs in the Engineering building
• Personal copy (full version, but for students only) can be purchased at
www,mathworks.com for $99. This is not required for ECEN2060
• Tutorial objectives: very basic introduction to the tools at the level
sufficient to understand ECEN2060 simulation models and do homework
assignments
ECEN2060 2
Start MATLAB, then start Simulink
Click here to start Simulink
Start MATLAB, then start Simulink
Click here to start Simulink Choose Current Directory
MATLAB commands
and scripts can be
executed
interactively in the
“Command Window”
ECEN2060 4
Simulink Library Browser
• Library Browser gives access to various
standard or additional blocks that are
used to build more complicated models
• ECEN2060 models will be constructed
using standard Simulink blocks from the
Simulink library
• Click File - New – Model (or Ctrl-N) to
start a new model window
CEN2060
E 5
Constructing and simulating a simple circuit model
iR
vac
+
vR
Circuit equation: iR = (1/R)vac
Simulink:
“Sine Wave”
block from

M
V = 1 V
R
10  output “Gain”
Block from
Math Operations
Sources
Drag an drop
Sine Wave block
from Sources in
the Library
ECEN2060 6
Drag an drop
Gain block from
Math Operations
in the Library
Drag an drop
Scope block
from Sinks in the
Library
Connect block inputs and outputs according to
the circuit equation
Double-click a block to change parameter
values
To better document the model, double-click on
the block name or on the connection line to
change block and signal names as desired
Constructing and simulating a simple circuit model
Total simulation time (10 seconds in
this example) can be changed here
Click here to start simulation
Autoscale
Scope
parameters
Double-click on the Scope
block to display the output
waveform (current iR)
Explore various menu options, block
properties, etc. For example:
• Add another axis to the Scope
and display both iR andvR
• Repeat simulations for different
values of the sinewave amplitude
or frequency, or different R
ECEN2060 7
Notes
• Simulink blocks have zero, one or more inputs and
zero, one or more outputs
• Inputs and outputs are all considered “signals”
• Unlike circuit-oriented simulators (e.g. Spice),
Simulink has no knowledge of whether a signal is
voltage, current, power, torque, speed, …, which
 makes it a very general tool for simulations of various
dynamical systems, but
 requires a user to decide which signals are inputs and
which signals are outputs, and make block connections to
correctly model system equations; as a result, Simulink
block diagrams may not be as intuitive as circuit diagrams
ECEN2060 8
Another example
Make sure you have downloaded pv1.mdl and findMPP.m to
a working folder (files are available on the course website,
MATLAB/Simulink page)
Set MATLAB
Current
Directory to
the folder
where you
downloaded
pv1.mdl and
findMPP.m
Double-
click
pv1.mdl to
open the
PV cell
Simulink
model
ECEN2060 9
Simple PV cell Simulink model pv1.mdl
+
vPV
+
vD
iD
ISC
Circuit model
iPV
Model equations
PV
D
o
D
D T
v  v
i  I 
e 1
,
v /V
input

 iPV  ISC iD
output
Product block from Math
ECEN2060
PV cell characteristics
PV
PV power
Ppv
Vpv
Ppv
Ipv
Operations
XY Graph block
from Sinks
Repeating
sequence
To Workspace
Product
1e-9*(exp(u/26e-3)-1) I-V characteristic
Vpv
Fcn block from User-
Defined Functions
block from
Sources
Vpv PN-junction characteristic
1/1000
1000
Insolation
ISC
Id
Ipv
To Workspace
block from Sinks
sends simulation
results to
MATLAB
workspace for
further
Insolation to
ISC current gain
processing
ECEN2060 10
Constant block from Sources
pv1.mdl Simulink model
Mux block from
Signal Routing
combines 3
signals into one
vector output
Run pv1 simulation
PV
Output current i as a function of
vPV is immediately displayed in
another X-Y Plot window
Output power Ppv (i.e the product
of iPV and vPV) as a function of vPV
is immediately displayed in a X-Y
Plot window
Output power Ppv, current iPV, voltage vPV, and simulation time are
stored in a “structure” variable PV, which is made available (using the
“To Workspace” block) for further processing in the MATLAB
Command Window
ECEN2060 11
Example of MATLAB processing of simulation results
Type “findMPP” and Enter in the MATLAB Command Window. This runs
the MATLAB script findMPP.m, which takes the simulation results and
finds the maximum power point (power, voltage and current) and again
plots power Ppv and Ipv as functions ofVpv.
Double-click on the
findMPP.m file to open
the script and examine
the MATLAB code
ECEN2060 12
More notes
• Simulink model and MATLAB Figure windows include a
“Copy” function in the “Edit” menu. This is useful for
reporting results: you can simply copy and paste your
models or graphical results into a Word or PowerPoint
document
• You may want to explore other options in the MATLAB
Figure window. For example, find out how add a grid,
change the line type, thickness or color, change the x-axis or
y-axis scales, etc.
• This tutorial is very limited in scope, just to get you started
with the tools we will be using to model and test various
electrical or electro-mechanical energy systems in
ECEN2060. You may want to browse through
Simulink/MATLAB HELP documentation to further explore
the tool capabilities
ECEN2060 13
Ad

More Related Content

Similar to matlab basics and Simulink for beginners (20)

Xcos for very beginners
Xcos for very beginnersXcos for very beginners
Xcos for very beginners
Scilab
 
M3M_250327ggggt_224420_250411_183353.pdf
M3M_250327ggggt_224420_250411_183353.pdfM3M_250327ggggt_224420_250411_183353.pdf
M3M_250327ggggt_224420_250411_183353.pdf
HebaEng
 
Hands-on-OpenIPSL.org using OpenModelica!
Hands-on-OpenIPSL.org using OpenModelica!Hands-on-OpenIPSL.org using OpenModelica!
Hands-on-OpenIPSL.org using OpenModelica!
Luigi Vanfretti
 
PV inverter
PV inverterPV inverter
PV inverter
Madhu Mahadevaswamy
 
simulink
simulinksimulink
simulink
Aditi Tiwari
 
Software_Introduction and Screen shot guidelines.pptx
Software_Introduction and Screen shot guidelines.pptxSoftware_Introduction and Screen shot guidelines.pptx
Software_Introduction and Screen shot guidelines.pptx
karthikmurugesan0823
 
Using matlab simulink
Using matlab simulinkUsing matlab simulink
Using matlab simulink
Marilyn Barragán Castañeda
 
Using matlab simulink
Using matlab simulinkUsing matlab simulink
Using matlab simulink
Marilyn Barragán Castañeda
 
welcometosimscale-companypresentationv2-160420145834 (1)
welcometosimscale-companypresentationv2-160420145834 (1)welcometosimscale-companypresentationv2-160420145834 (1)
welcometosimscale-companypresentationv2-160420145834 (1)
Kristina Lowe
 
Welcome to SimScale
Welcome to SimScaleWelcome to SimScale
Welcome to SimScale
Sijia Ma
 
Simulation lab
Simulation labSimulation lab
Simulation lab
Ezhilarasi Nagarajan
 
Pspice software+ presentation
Pspice software+ presentationPspice software+ presentation
Pspice software+ presentation
RAhul Soni
 
Ni labview y multisim
Ni labview y multisimNi labview y multisim
Ni labview y multisim
Tame Claudio
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of Signals
Coding Academy
 
E0463137
E0463137E0463137
E0463137
IOSR Journals
 
Overview of RTaW SysML-Companion
Overview of RTaW SysML-Companion Overview of RTaW SysML-Companion
Overview of RTaW SysML-Companion
RealTime-at-Work (RTaW)
 
Scilab
ScilabScilab
Scilab
Kripal Priyadarshi
 
FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide
FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart GuideFEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide
FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide
FEATool Multiphysics
 
Matlab simulink
Matlab simulinkMatlab simulink
Matlab simulink
pramodkumar1804
 
cscript_controller.pdf
cscript_controller.pdfcscript_controller.pdf
cscript_controller.pdf
VcTrn1
 
Xcos for very beginners
Xcos for very beginnersXcos for very beginners
Xcos for very beginners
Scilab
 
M3M_250327ggggt_224420_250411_183353.pdf
M3M_250327ggggt_224420_250411_183353.pdfM3M_250327ggggt_224420_250411_183353.pdf
M3M_250327ggggt_224420_250411_183353.pdf
HebaEng
 
Hands-on-OpenIPSL.org using OpenModelica!
Hands-on-OpenIPSL.org using OpenModelica!Hands-on-OpenIPSL.org using OpenModelica!
Hands-on-OpenIPSL.org using OpenModelica!
Luigi Vanfretti
 
Software_Introduction and Screen shot guidelines.pptx
Software_Introduction and Screen shot guidelines.pptxSoftware_Introduction and Screen shot guidelines.pptx
Software_Introduction and Screen shot guidelines.pptx
karthikmurugesan0823
 
welcometosimscale-companypresentationv2-160420145834 (1)
welcometosimscale-companypresentationv2-160420145834 (1)welcometosimscale-companypresentationv2-160420145834 (1)
welcometosimscale-companypresentationv2-160420145834 (1)
Kristina Lowe
 
Welcome to SimScale
Welcome to SimScaleWelcome to SimScale
Welcome to SimScale
Sijia Ma
 
Pspice software+ presentation
Pspice software+ presentationPspice software+ presentation
Pspice software+ presentation
RAhul Soni
 
Ni labview y multisim
Ni labview y multisimNi labview y multisim
Ni labview y multisim
Tame Claudio
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of Signals
Coding Academy
 
FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide
FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart GuideFEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide
FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide
FEATool Multiphysics
 
cscript_controller.pdf
cscript_controller.pdfcscript_controller.pdf
cscript_controller.pdf
VcTrn1
 

Recently uploaded (20)

"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
charlesdick1345
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
Smart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptxSmart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptx
rushikeshnavghare94
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
New Microsoft PowerPoint Presentation.pdf
New Microsoft PowerPoint Presentation.pdfNew Microsoft PowerPoint Presentation.pdf
New Microsoft PowerPoint Presentation.pdf
mohamedezzat18803
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
Mathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdfMathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdf
TalhaShahid49
 
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Journal of Soft Computing in Civil Engineering
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
LECTURE-16 EARTHEN DAM - II.pptx it's uses
LECTURE-16 EARTHEN DAM - II.pptx it's usesLECTURE-16 EARTHEN DAM - II.pptx it's uses
LECTURE-16 EARTHEN DAM - II.pptx it's uses
CLokeshBehera123
 
15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...
IJCSES Journal
 
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxbMain cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
SunilSingh610661
 
Artificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptxArtificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptx
DrMarwaElsherif
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
charlesdick1345
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
Smart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptxSmart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptx
rushikeshnavghare94
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
New Microsoft PowerPoint Presentation.pdf
New Microsoft PowerPoint Presentation.pdfNew Microsoft PowerPoint Presentation.pdf
New Microsoft PowerPoint Presentation.pdf
mohamedezzat18803
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
Mathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdfMathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdf
TalhaShahid49
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
LECTURE-16 EARTHEN DAM - II.pptx it's uses
LECTURE-16 EARTHEN DAM - II.pptx it's usesLECTURE-16 EARTHEN DAM - II.pptx it's uses
LECTURE-16 EARTHEN DAM - II.pptx it's uses
CLokeshBehera123
 
15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...
IJCSES Journal
 
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxbMain cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
SunilSingh610661
 
Artificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptxArtificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptx
DrMarwaElsherif
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
Ad

matlab basics and Simulink for beginners

  • 2. MATLAB/Simulink • MathWorks tools for technical computing and simulations, widely used across various engineering and science disciplines • MATLAB  Programming language and interactive environment well suited for computing, algorithms, data processing and visualization • Simulink  Environment for graphical, model-based simulation of dynamic systems • Available in all computer labs in the Engineering building • Personal copy (full version, but for students only) can be purchased at www,mathworks.com for $99. This is not required for ECEN2060 • Tutorial objectives: very basic introduction to the tools at the level sufficient to understand ECEN2060 simulation models and do homework assignments ECEN2060 2
  • 3. Start MATLAB, then start Simulink Click here to start Simulink
  • 4. Start MATLAB, then start Simulink Click here to start Simulink Choose Current Directory MATLAB commands and scripts can be executed interactively in the “Command Window” ECEN2060 4
  • 5. Simulink Library Browser • Library Browser gives access to various standard or additional blocks that are used to build more complicated models • ECEN2060 models will be constructed using standard Simulink blocks from the Simulink library • Click File - New – Model (or Ctrl-N) to start a new model window CEN2060 E 5
  • 6. Constructing and simulating a simple circuit model iR vac + vR Circuit equation: iR = (1/R)vac Simulink: “Sine Wave” block from  M V = 1 V R 10  output “Gain” Block from Math Operations Sources Drag an drop Sine Wave block from Sources in the Library ECEN2060 6 Drag an drop Gain block from Math Operations in the Library Drag an drop Scope block from Sinks in the Library Connect block inputs and outputs according to the circuit equation Double-click a block to change parameter values To better document the model, double-click on the block name or on the connection line to change block and signal names as desired
  • 7. Constructing and simulating a simple circuit model Total simulation time (10 seconds in this example) can be changed here Click here to start simulation Autoscale Scope parameters Double-click on the Scope block to display the output waveform (current iR) Explore various menu options, block properties, etc. For example: • Add another axis to the Scope and display both iR andvR • Repeat simulations for different values of the sinewave amplitude or frequency, or different R ECEN2060 7
  • 8. Notes • Simulink blocks have zero, one or more inputs and zero, one or more outputs • Inputs and outputs are all considered “signals” • Unlike circuit-oriented simulators (e.g. Spice), Simulink has no knowledge of whether a signal is voltage, current, power, torque, speed, …, which  makes it a very general tool for simulations of various dynamical systems, but  requires a user to decide which signals are inputs and which signals are outputs, and make block connections to correctly model system equations; as a result, Simulink block diagrams may not be as intuitive as circuit diagrams ECEN2060 8
  • 9. Another example Make sure you have downloaded pv1.mdl and findMPP.m to a working folder (files are available on the course website, MATLAB/Simulink page) Set MATLAB Current Directory to the folder where you downloaded pv1.mdl and findMPP.m Double- click pv1.mdl to open the PV cell Simulink model ECEN2060 9
  • 10. Simple PV cell Simulink model pv1.mdl + vPV + vD iD ISC Circuit model iPV Model equations PV D o D D T v  v i  I  e 1 , v /V input   iPV  ISC iD output Product block from Math ECEN2060 PV cell characteristics PV PV power Ppv Vpv Ppv Ipv Operations XY Graph block from Sinks Repeating sequence To Workspace Product 1e-9*(exp(u/26e-3)-1) I-V characteristic Vpv Fcn block from User- Defined Functions block from Sources Vpv PN-junction characteristic 1/1000 1000 Insolation ISC Id Ipv To Workspace block from Sinks sends simulation results to MATLAB workspace for further Insolation to ISC current gain processing ECEN2060 10 Constant block from Sources pv1.mdl Simulink model Mux block from Signal Routing combines 3 signals into one vector output
  • 11. Run pv1 simulation PV Output current i as a function of vPV is immediately displayed in another X-Y Plot window Output power Ppv (i.e the product of iPV and vPV) as a function of vPV is immediately displayed in a X-Y Plot window Output power Ppv, current iPV, voltage vPV, and simulation time are stored in a “structure” variable PV, which is made available (using the “To Workspace” block) for further processing in the MATLAB Command Window ECEN2060 11
  • 12. Example of MATLAB processing of simulation results Type “findMPP” and Enter in the MATLAB Command Window. This runs the MATLAB script findMPP.m, which takes the simulation results and finds the maximum power point (power, voltage and current) and again plots power Ppv and Ipv as functions ofVpv. Double-click on the findMPP.m file to open the script and examine the MATLAB code ECEN2060 12
  • 13. More notes • Simulink model and MATLAB Figure windows include a “Copy” function in the “Edit” menu. This is useful for reporting results: you can simply copy and paste your models or graphical results into a Word or PowerPoint document • You may want to explore other options in the MATLAB Figure window. For example, find out how add a grid, change the line type, thickness or color, change the x-axis or y-axis scales, etc. • This tutorial is very limited in scope, just to get you started with the tools we will be using to model and test various electrical or electro-mechanical energy systems in ECEN2060. You may want to browse through Simulink/MATLAB HELP documentation to further explore the tool capabilities ECEN2060 13