Modeling in MatLab Flashcards
y = [18 15 14 17 13 18 15]
y(5)=
13
y = [18 15 14 17 13 18 15]
y(3:5)
14 17 13
y = [18 15 14 17 13 18 15] b = y(2:3:7)
15 13
z = 1 2 3 4 5
z’=
z= 1 2 3 4 5
x = 0:2:7
x= 2 4 6
x=1:5
x =1 2 3 4 5
g = [2 3 4] h = [-1 2 3]
g+h
1 5 7
x= [1 2 3 4] y= [1 2 3 4]
x*y=
Invalid
x= [1 2 3] y= [1; 2; 3]
x*y=
16
x= [1 2 3] y= [1; 2; 3]
x.*y=
ans = 1 3 9
plot(t,empirical,’go–’)
what will appear as the options
green -o-
In a function the file name and the function name must be
the same with the file name has .m
Functions=
Scripts=
Functions perform calculations
Scripts Executes commands
what are ODE45
a function with an initial conditon
ODE stands for
Ordinary Differential
Equations
Real-world systems are
dynamical systems
What do you need for an ODE
the function ODE and the initial condition
This is an ODE
[t,h]= ode45(‘sex’,[0 20],h0);
what is [t,h] returns a value
t as the specified range [0 20]
This is an ODE
[t,h]= ode45(‘sex’,[0 20],h0);
what is sex
the name of the function describing the ODE problem
This is an ODE
[t,h]= ode45(‘sex’,[0 20],h0);
[0 20] represents
the specified range for t on the x axis
This is a script
h0=2000
[t,h]= ode45(‘sex’,[0 20],h0);
how can we rewrite this ode
replace h0 with 2000 as it represents the initial condition