Skip to content

Commit 1762fbf

Browse files
committed
updated function header
1 parent 3937339 commit 1762fbf

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

c2d_euler.m

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,16 @@
99
% See also c2d.
1010
%
1111
% Copyright © 2021 Tamas Kis
12-
% Last Update: 2021-10-09
12+
% Last Update: 2022-04-20
1313
% Website: https://tamaskis.github.io
1414
1515
%
1616
% TECHNICAL DOCUMENTATION:
1717
% https://tamaskis.github.io/documentation/Continuous_to_Discrete_Transfer_Function_Transformation_Using_the_Euler_Methods.pdf
1818
%
19-
% REFERENCES:
20-
% [1] Franklin et. al., "Digital Control of Dynamic Systems", 3rd Ed.
21-
% [2] https://www.mathworks.com/matlabcentral/answers/96275-how-can-i-convert-a-transfer-function-object-from-the-control-system-toolbox-into-a-symbolic-object
22-
% [3] https://gist.github.com/maruta/1035254
23-
% [4] https://www.mathworks.com/matlabcentral/fileexchange/27302-syms-to-tf-conversion
19+
% REQUIREMENTS:
20+
% • Control System Toolbox
21+
% • Symbolic Math Toolbox
2422
%
2523
%--------------------------------------------------------------------------
2624
%
@@ -30,7 +28,7 @@
3028
% Hs - (1×1 tf or zpk) continous transfer function
3129
% T - (1×1 double) sampling period
3230
% type - (char) 'forward' or 'backward'
33-
% output - (OPTIONAL) (char) specifies output type ('tf' or 'zpk')
31+
% output - (char) (OPTIONAL) specifies output type ('tf' or 'zpk')
3432
%
3533
% -------
3634
% OUTPUT:
@@ -40,19 +38,11 @@
4038
%==========================================================================
4139
function Hz = c2d_euler(Hs,T,type,output)
4240

43-
% ----------------------------------------------------
44-
% Sets unspecified parameters to their default values.
45-
% ----------------------------------------------------
46-
47-
% defaults "output" to 'tf'
41+
% defaults "output" to 'tf' if not input
4842
if (nargin < 4) || isempty(output)
4943
output = 'tf';
5044
end
5145

52-
% --------------------------------------
53-
% Continuous-to-discrete transformation.
54-
% --------------------------------------
55-
5646
% symbolic variable for z;
5747
z = sym('z');
5848

@@ -75,7 +65,7 @@
7565
[sym_num,sym_den] = numden(Hz);
7666
num = sym2poly(sym_num);
7767
den = sym2poly(sym_den);
78-
68+
7969
% creates discrete transfer function model
8070
Hz = tf(num,den,T);
8171

0 commit comments

Comments
 (0)