From 182c84a506fd6a2b177175794a796cf33828b06a Mon Sep 17 00:00:00 2001 From: marcotti Date: Thu, 2 Jul 2020 19:04:15 -0300 Subject: [PATCH 1/2] :sparkles: identificacion por arx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit se utiliza la función arx de matlab para identicar un paquete --- identification_methods.m | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/identification_methods.m b/identification_methods.m index e0fb726..d5ad704 100644 --- a/identification_methods.m +++ b/identification_methods.m @@ -71,15 +71,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) @@ -147,4 +156,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 \ No newline at end of file +end From f1bac3322269e72a7aec62c05728967191d4f6d7 Mon Sep 17 00:00:00 2001 From: marcotti Date: Thu, 2 Jul 2020 19:15:14 -0300 Subject: [PATCH 2/2] :hammer: refactorear frecuencia de muestreo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previamente la frecuencia de muestreo era una variable global pero puede ser encapsulada en una sola función. --- identification_methods.m | 2 -- 1 file changed, 2 deletions(-) diff --git a/identification_methods.m b/identification_methods.m index d5ad704..042778d 100644 --- a/identification_methods.m +++ b/identification_methods.m @@ -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; % Discretizacion Gz = c2d(Gs, Ts, 'zoh')