16
UNIVERSIDADE FEDERAL DE SÃO JOÃO DEL-REI MESTRADO EM ENGENHARIA ELÉTRICA PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Modelagem matemática baseado no adaline Elaborado por: Juan Pablo Ochoa Avilés [email protected] 06 DE NOVEMBRO DE 2015

ARMAX.pdf

  • Upload
    juan8a

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ARMAX.pdf

UNIVERSIDADE FEDERAL DE SÃO JOÃO DEL-REI

MESTRADO EM ENGENHARIA ELÉTRICA

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ

Modelagem matemática baseado no adaline

Elaborado por:

Juan Pablo Ochoa Avilés

[email protected]

06 DE NOVEMBRO DE 2015

Page 2: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

2

Juan Pablo Ochoa Avilés, novembro 2015

Introdução

Os modelos matemáticos devem ser constituídos a partir de dados

observados que descrevam o comportamento do sistema em estudo. Assim,

modelagem matemática é a área do conhecimento que estuda maneiras de

construir e implementar modelos (matemáticos) de sistemas reais.

A motivação para o estudo de técnicas de identificação de sistemas surge do

fato que frequentemente não se conhecem as equações envolvidas no

funcionamento de um determinado sistema ou elas são conhecidas, mas seria

impraticável, por limitações de tempo e recursos, levantar tais equações e

estimar seus respectivos parâmetros.

O presente trabalho está focado na identificação de um sistema para uma

sonda de temperatura, sendo os valores experimentais para entrada uma

tensão de caraterística degrau, e para a saída gerada uma variação de

temperatura, para um período de amostragem de 2 segundos, isso é

observado na figura 1.

Figura 1: Valores da tensão de entrada

A seguir serão apresentados os passos requeridos para conseguir uma

modelagem matemática que seja a representação do modelo físico obtido

experimentalmente.

0 200 400 600 800 1000 1200 1400 16000

20

40

60

80

100

120

140

160

180

200

tempo discreto

Valo

res m

edid

os p

ara

a e

ntr

ada e

a s

aid

a

tensão de entrada

temperatura de saida

Page 3: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

3

Juan Pablo Ochoa Avilés, novembro 2015

Metodologia

A partir dos dados fornecidos, desenhou-se pela ferramenta GUIDE de

MATLAB, uma interface gráfica nomeada ARMAX (autoregressive moving

average with exogenous inputs), pelas suas siglas em inglês, mostra-se na

figura 2, a janela principal de controle a qual manipula os dados respeito aos

requerimentos do usuário.

Figura 2: Aplicativo ARMAX

Na zona de aprendizagem é possível determinar os valores para a regressão

tanto para a entrada quanto para a saída, também é opcional considerar a

validação cruzada e o ajuste automático da taxa de treino.

Na área branca, vai se apresentar os valores do erro meio quadrático por

iteração sendo o limite estabelecido de ẟ=0.0001.

Para a estimativa da avaliação, feita após do aprendizagem, tem-se a

possibilidade de escolher predição a 1 elemento, 5 elementos e ∞ elementos.

Page 4: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

4

Juan Pablo Ochoa Avilés, novembro 2015

Com a rede treinada e validada o seguinte passo é obter a função de

transferência H(s), que associa a entrada U(s) com a saída Y(s), o que

conseguisse logo de marcar com o mouse “star” no ARMAX.

Finalmente serão mostrados os gráficos para a rede treinada e a modelagem.

• Ajuste automático da taxa de aprendizado: Analisando os valores

obtidos em cada iteração, e avaliando a diferencia entre os 5 últimos;

se fosse superior a 0.4, então o valor de η que inicialmente é 0.000004,

será modificado para 1.0002 acima, desse modo segurasse que se cair

num mínimo e este fosse local, vai conseguir sair e continuar na

procura de um mínimo global.

• Validação cruzada: Os dados são divididos em 3 grupos

aletoriamente, onde cada um deles tem uma parcela para avaliação e

outra parcela para treino, sendo estas parcelas da mesma dimensão

para cada um dos grupos, aplicasse o adaline para cada um dos grupos

e finalmente é conseguido um melhor desempenho já que ao final

todos os dados serão considerados tanto para avaliação e para treino,

assim conseguisse garantir que o erro do treino não será maior que o

erro da avaliação.

Resultados

Após alguns execuções do algoritmo foram obtidos os dos melhores valores

em função do erro meio quadrático, sendo o primeiro para uma regressão de

primeira ordem e o segundo para uma regressão de segunda ordem, os dados

são apresentados na tabela 1.

Tabela 1

Indicadores de desempenho

Ordem EMQ Vector de pesos W

H(Z)

1° (T1) 0.315741

0.9677

1.2176

-0.5724

-0.5724 z + 1.216

-------------------------

z - 0.9677

2° (T2) 0.277372

-0.1504

1.1178

1.1005

-1.0706

0.6193

0.6193 z^2 - 1.071 z + 1.101

------------------------------------

z^2 - 1.118 z + 0.1504

Page 5: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

5

Juan Pablo Ochoa Avilés, novembro 2015

Partindo da função de transferência H(Z), através da sentencia “[N,D] =

d2cm(Nz,Dz,Ts)”, conseguisse passar do tempo discreto para o tempo

continuo, dito de outro modo, do domínio de Z para o domínio de S, sendo

as funções de transferência obtidas as seguintes.

Tabela 2

Funções em tempo contínuo

Ordem H(S)

Primeira

-0.5724 s + 0.3269

-------------------------

s + 0.01642

Segunda

0.6193 s^2 - 0.3009 s + 0.364

--------------------------------------

s^2 + 0.9472 s + 0.01828

Baseados no erro, seria coerente dizer que a resposta da função de segundo

ordem é melhor que a função de primeiro ordem, nas figuras 3 e 4,

observasse cada uma das respostas no domínio do tempo para as funções de

transferência obtidas.

Figura 3: Resposta para a função de segundo ordem

0 200 400 600 800 1000 1200 1400 16000

20

40

60

80

100

120

140

160

180

200

Linear Simulation Results

Time (seconds)

Am

plit

ude

Page 6: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

6

Juan Pablo Ochoa Avilés, novembro 2015

Figura 4: Resposta para a função de primeiro ordem

Por uma inspeção visual das figuras 3 e 4, é possível confirmar o expressado

anteriormente baseados no EQM, que a resposta da função de transferência

de segundo ordem é uma representação mais aproximada dos dados

experimentais iniciais. Conclusões

• Foi possível obter uma função temporária que representa o

comportamento do sistema da sonda de temperatura, o que pelo

método clássico teria sido muito complicado.

• Um indicador importante é o EQM, pois dá uma ideia do desempenho

antes de fazer a análise das funções de transferência.

• Foi de muita utilidade a inclusão do ajuste automático da taxa de

aprendizagem e a validação cruzada, pois o erro diminuiu até valores

que antes eram impossíveis.

Bibliografía Aguirre, L. A. (2007). Introdução à identificação de sistemas. Belo Horizonte: UFMG.

CHAPMAN, S. J. (2011). programaçao em MATLAB para engenheiros. SAO PAULO: CENAGE

LEARNING.

Ivan Nunez da Silva, D. H. (2010). Redes Neurais Artificiais para engenharia e ciências

aplicadas. São Paulo: Artliber.

0 200 400 600 800 1000 1200 1400 16000

20

40

60

80

100

120

140

160

180

200

Linear Simulation Results

Time (seconds)

Am

plit

ude

Page 7: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

7

Juan Pablo Ochoa Avilés, novembro 2015

ANEXOS

Funciones desenvolvidas

function varargout = ARMAX(varargin) % ARMAX MATLAB code for ARMAX.fig % ARMAX, by itself, creates a new ARMAX or raises the existing % singleton*. % % H = ARMAX returns the handle to a new ARMAX or the handle to % the existing singleton*. % % ARMAX('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in ARMAX.M with the given input arguments. % % ARMAX('Property','Value',...) creates a new ARMAX or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before ARMAX_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to ARMAX_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help ARMAX % Last Modified by GUIDE v2.5 10-Nov-2015 01:13:26 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @ARMAX_OpeningFcn, ... 'gui_OutputFcn', @ARMAX_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before ARMAX is made visible. function ARMAX_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure

Page 8: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

8

Juan Pablo Ochoa Avilés, novembro 2015

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to ARMAX (see VARARGIN) % Choose default command line output for ARMAX handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes ARMAX wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = ARMAX_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; % --- Executes on selection change in popupmenu2. function popupmenu2_Callback(hObject, eventdata, handles) % hObject handle to popupmenu2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu2 janela=(get(handles.popupmenu2,'Value'))-1; guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function popupmenu2_CreateFcn(hObject, eventdata, handles) % hObject handle to popupmenu2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on selection change in popupmenu3. function popupmenu3_Callback(hObject, eventdata, handles) % hObject handle to popupmenu3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB

Page 9: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

9

Juan Pablo Ochoa Avilés, novembro 2015

% handles structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu3 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu3 % --- Executes during object creation, after setting all properties. function popupmenu3_CreateFcn(hObject, eventdata, handles) % hObject handle to popupmenu3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on selection change in popupmenu4. function popupmenu4_Callback(hObject, eventdata, handles) % hObject handle to popupmenu4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu4 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu4 guidata(hObject, handles); % --- Executes during object creation, after setting all properties. function popupmenu4_CreateFcn(hObject, eventdata, handles) % hObject handle to popupmenu4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on selection change in popupmenu5. function popupmenu5_Callback(hObject, eventdata, handles) % hObject handle to popupmenu5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu5 contents as cell array

Page 10: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

10

Juan Pablo Ochoa Avilés, novembro 2015

% contents{get(hObject,'Value')} returns selected item from popupmenu5 % --- Executes during object creation, after setting all properties. function popupmenu5_CreateFcn(hObject, eventdata, handles) % hObject handle to popupmenu5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) clc taxa=(get(handles.taxa,'value')); cruza=(get(handles.validacao,'value')); eta=0.000004; eps=0.0001; tempo=1; load heating_system.dat; Y=heating_system(:,3)'; X=heating_system(:,2)'; tg=heating_system(:,1); trama=length(Y); ya=Y(1:2*trama/3); Y1a=Y((trama-trama/3+1):trama); xa=X(1:2*trama/3); X1a=X((trama-trama/3+1):trama); yb=[Y(1:trama/3) Y(2*trama/3+1:trama)]; Y1b=Y((trama/3+1):(2*trama/3)); xb=[X(1:trama/3) X(2*trama/3+1:trama)]; X1b=X((trama/3+1):(2*trama/3)); yc=Y(trama/3+1:trama); Y1c=Y(1:trama/3); xc=X(trama/3+1:trama); X1c=X(1:trama/3); y=Y(1,1:500); Y1=Y(1,501:801); x=X(1,1:500); X1=X(1,501:801);

Page 11: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

11

Juan Pablo Ochoa Avilés, novembro 2015

janela =str2double(get(handles.edit1,'string')); janela1 =str2double(get(handles.edit2,'string')); pos =get(handles.popupmenu4,'value'); if pos==1 T=1; end if pos==2 T=5; end if pos==3 T=0; end if T>janela T=janela; end if cruza==0 fim=length(y); i=0; for i=1:fim-janela yin(i,:)=y(i:janela+i-1); yout(i)=y(janela + i); xin(i,:)=[x(janela-janela1+i:janela+i)]; % xin(i,:)=[x(janela-janela1+i:janela+i-1), -1]; end YIN=[yin xin]; [linha1,~]=size(YIN'); w=1*randn(1,linha1); end while tempo<4 if cruza == 1 switch tempo case 1 fim1=length(ya); i=0; for i=1:fim1-janela yin(i,:)=ya(i:janela+i-1); yout(i)=ya(janela + i); xin(i,:)=[xa(janela-janela1+i:janela+i)]; %xin(i,:)=[xa(janela-janela1+i:janela+i-1),-1]; end YIN=[yin xin]; [linha1,~]=size(YIN'); w=1*randn(1,linha1); case 2 fim2=length(yb); i=0; for i=1:fim2-janela yin(i,:)=yb(i:janela+i-1); yout(i)=yb(janela + i); xin(i,:)=[xb(janela-janela1+i:janela+i)];

Page 12: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

12

Juan Pablo Ochoa Avilés, novembro 2015

%xin(i,:)=[xb(janela-janela1+i:janela+i-1),-1]; end YIN=[yin xin]; w=W; case 3 fim3=length(yc); i=0; for i=1:fim3-janela yin(i,:)=yc(i:janela+i-1); yout(i)=yc(janela + i); xin(i,:)=[xc(janela-janela1+i:janela+i)]; %xin(i,:)=[xc(janela-janela1+i:janela+i-1),-1]; end YIN=[yin xin]; w=W; end tempo=tempo+1; else tempo=4; end [ W,iter,eqm,eta ] = adaline(YIN,yout,eta,eps,taxa,w); end set(handles.text9,'String',eqm(iter)); fim=length(y); i=0; for i=1:fim-janela yplot(i,:)=y(i:janela+i-1); %xplot(i,:)=[x(janela-janela1+i:janela+i-1),-1]; xplot(i,:)=[x(janela-janela1+i:janela+i)]; end Yplot=[yplot xplot]; sal=[y(1,1:janela) W*Yplot']; tg1=tg(1:500); figure plot(tg,Y); hold on plot(tg1,sal,'-go','MarkerSize',1); final=length(Y1); for i=1:final-janela YYin(i,:)=Y1(i:janela+i-1); YYout(i)=Y1(janela + i); %XXin(i,:)=[X1(janela-janela1+i:janela+i-1),-1]; XXin(i,:)=[X1(janela-janela1+i:janela+i)]; end base=Y1(1,1:janela); [c,~]=size(YYin); YYIN=[YYin XXin]; count = 0; for j=1:c

Page 13: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

13

Juan Pablo Ochoa Avilés, novembro 2015

resposta(j)=W*YYIN(j,:)'; count=count+1; if count == T for k=1:T YYin(j+1,janela-T+k)=resposta(j-T+k); end count =count - 1; end end time=tg(501:801); resposta=[base resposta]; xlswrite('W_armax.xlsx',W); hold on plot(time,resposta,'-r+','MarkerSize',3); grid on function edit1_Callback(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit1 as text % str2double(get(hObject,'String')) returns contents of edit1 as a double % --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) A1= str2double(get(handles.edit1,'String'))+1; set(handles.edit1,'String',A1); % --- Executes on button press in pushbutton3. function pushbutton3_Callback(hObject, eventdata, handles) % hObject handle to pushbutton3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) A1= str2double(get(handles.edit1,'String'));

Page 14: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

14

Juan Pablo Ochoa Avilés, novembro 2015

if A1>0 A1= str2double(get(handles.edit1,'String'))-1; end set(handles.edit1,'String',A1); function edit2_Callback(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit2 as text % str2double(get(hObject,'String')) returns contents of edit2 as a double % --- Executes during object creation, after setting all properties. function edit2_CreateFcn(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in pushbutton6. function pushbutton6_Callback(hObject, eventdata, handles) % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) A2= str2double(get(handles.edit2,'String'))+1; set(handles.edit2,'String',A2); % --- Executes on button press in pushbutton7. function pushbutton7_Callback(hObject, eventdata, handles) % hObject handle to pushbutton7 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) A2= str2double(get(handles.edit2,'String')); if A2>0 A2= str2double(get(handles.edit2,'String'))-1; end set(handles.edit2,'String',A2); % --- Executes on button press in taxa. function taxa_Callback(hObject, eventdata, handles) % hObject handle to taxa (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB

Page 15: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

15

Juan Pablo Ochoa Avilés, novembro 2015

% handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of taxa % --- Executes on button press in validacao. function validacao_Callback(hObject, eventdata, handles) % hObject handle to validacao (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of validacao % --- Executes on button press in pushbutton8. function pushbutton8_Callback(hObject, eventdata, handles) % hObject handle to pushbutton8 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) W=xlsread('W_armax.xlsx'); % janela=2; % janela1=2; y0=129; janela =str2double(get(handles.edit1,'string')); janela1 =str2double(get(handles.edit2,'string')); LW=janela + janela1 +1; grau=janela-janela1; load heating_system.dat; Y=heating_system(:,3)'; u=heating_system(:,2); t=heating_system(:,1); Ts=2; Nz=fliplr(W((LW-janela1):(LW))); Nz=[Nz zeros(1,grau)]; Dz=-fliplr(W((1):(LW-janela1-1))); Dz=[1 Dz]; [N,D] = d2cm(Nz,Dz,Ts); %HZ=tf(W(2),[1 -W(1)],2); H=tf(N,D); H_sym=evalc('H'); set(handles.text12,'string',H_sym); figure; plot(t,Y); hold on lsim(H,u,t,y0,'-r'); grid on function edit4_Callback(hObject, eventdata, handles)

Page 16: ARMAX.pdf

PROGAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA ELÉTRIA - UFSJ Mestrado em Engenharia Elétrica

16

Juan Pablo Ochoa Avilés, novembro 2015

% hObject handle to edit4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit4 as text % str2double(get(hObject,'String')) returns contents of edit4 as a double % --- Executes during object creation, after setting all properties. function edit4_CreateFcn(hObject, eventdata, handles) % hObject handle to edit4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end