-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathharvester_solver_time.m
More file actions
23 lines (20 loc) · 967 Bytes
/
Copy pathharvester_solver_time.m
File metadata and controls
23 lines (20 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function [time,Y] = harvester_solver_time(X,IC,Tan)
% MODEL PARAMETERS
chi = X(1); % piezoeletric coupling term (mechanical)
f = X(2); % excitation amplitude
k1 = X(3); % mechanical stiffness k1
k2 = X(4); % mechanical stiffness k2
kappa = X(5); % piezoeletric coupling term (eletrical)
Lambda = X(6); % reciprocal time constant
omega = X(7); % excitation frequency
zeta = X(8); % mechanical damping ratio
% ODE SPACE-STATES
dydt = @(t,y)[y(2);
- 2.*zeta.*y(2) - k1.*y(1) + k2.*(y(1) - y(3)) + chi.*y(5) + f.*cos(omega.*t);
y(4);
- 2.*zeta.*y(4) + k2.*(y(1) - y(3));
- Lambda.*y(5) - kappa.*(y(2) - y(4))];
% ODE45 (Runge-Kutta45) SOLVER
opt = odeset('RelTol',1.0e-6,'AbsTol',1.0e-9,'OutputFcn',@odetpbar);
[time,Y] = ode45(dydt,Tan,IC,opt); % ODE45 solver
end