Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions identification_methods.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
Gs = (20*s+500)/((3*s+1)*(5*s+1))
% Periodo de muestreo
Ts = 0.1;
% Frecuencia de Muestreo
frec_sampl = 1/Ts;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me gustaba más como global pero va a funcionar igual.

% Discretizacion
Gz = c2d(Gs, Ts, 'zoh')

Expand Down Expand Up @@ -71,15 +69,24 @@
%#definidas, residual_analysis indica si se debe plotear un análisis de residuos
%#
%# SYNOPSIS discrete_ident_arx(data, Ts, focus_mode, na, nb, nk, residual_analysis)
%# INPUT data(iddata): paquete de identificación
%# INPUT Ts(double): tiempo de muestreo
%# INPUT focus_mode(*char): modo para Opt.Focus
%# INPUT na(double):
%# INPUT nb(double):
%# INPUT nk(double):
%# INPUT residual_analysis(logical): opción de analizar los residuos
%# OUTPUT Gzi(tf): función de transferencia del sistema identificado por arx

%# INPUT data(package):
%# INPUT Ts(float):
%# INPUT focus_mode(string):
%# INPUT na(float):
%# INPUT nb(float):
%# INPUT nk(float):
%# INPUT residual_analysis(boolean):
%# OUTPUT Gzi(tf):
Opt = arxOptions;
Opt.Focus = focus_mode;
sys_id = arx(data, [na nb nk], Opt);
[num, den] = tfdata(sys_id);
Gzi = tf(num, den, Ts)

frecuency_sampling = 1/Ts;
if residual_analysis
analyze_residuals(data, sys_id, frecuency_sampling)
end
end

function Gzi_mc = discrete_ident_recursive_least_squares(data, Ts, plot_ident)
Expand Down Expand Up @@ -147,4 +154,4 @@ function validate_identifications(data, Gzi, Gzi_mc)
xlabel('Tiempo [s]');
legend(sprintf('ARX (%2.2f)', fit), sprintf('RLS (%2.2f)', fit_mc), 'Salida', 'Location', 'SouthEast');
print -dsvg validate-model.svg
end
end