-
Notifications
You must be signed in to change notification settings - Fork 0
/
motor_mbk.m
39 lines (32 loc) · 828 Bytes
/
motor_mbk.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
% Authors: Alejandro R. Mosteo, Danilo Tardioli, Eduardo Montijano
% Copyright 2018-9999 Monmostar
% Licensed under GPLv3 https://www.gnu.org/licenses/gpl-3.0.en.html
%
% A motor that has 2nd order response (plus integrator!)
classdef motor_mbk < i_tf
properties
M, B, K
end
methods
function this = motor_mbk(M, B, K)
% NOTE: tau = 1/zwn
% To provide M, B, K:
% mu = 1/K
% tau = 2*M/B
% wn = sqrt(K/M)
this.M = M;
this.B = B;
this.K = K;
end
function ctf = get_tf(this)
s = tf('s');
if this.K > 0
ctf = this.K/(this.M*s^2 + this.B*s + this.K);
elseif this.B > 0
ctf = this.B/(this.M*s^2 + this.B*s);
else
ctf = this.M/(this.M*s^2);
end
end
end
end