FEVEREIRO-2014
Projeto de Controlador
Cdigo do prgrama
clear all
clc
%_____________________________________________________________
% Frequncia natural
z = 2/(2*wn);
% Fator de amortecimento
num = [7];
den = [1 2 7];
t = 0:0.005:10;
% Variao do tempo
[y,x,t] = step(num,den,t);
%_____________________________________________________________
r = 1; while y(r)<1.0001;
r = r+1;
end;
% Y nximo
[ymax,tp] = max(y);
max_overshoot = ymax - 1;
Mp = max_overshoot*100;
end
Ts = (s-1)*0.005;
fprintf('O tempo de acomodao de %f segundos. \n\n\n', Ts)
%
______________________________________________________________
% frequncia natural.
% Para Ts = 2 segundos:
wn1 = 4/(2*z1);
% Frequncia
natural
t = 0:0.005:10;
% Variao do tempo
[y1,x1,t] = step(num1,den1,t);
%_____________________________________________________________
______
r = 1; while y(r)<1.0001;
r = r+1;
end;
% Y mximo
[ymax1,tp] = max(y1);
end
Ts = (s-1)*0.005;
fprintf('O tempo de acomodao de %f segundos. \n\n', Ts)
%_____________________________________________________________
______
% Plotagem de Grficos
subplot(211)
plot(t,y,'k'), grid
ylabel('Y(t)')
xlabel('Tempo(s)')
title('Resposta de uma funo de transferncia em malha
fechada')
subplot(212)
plot(t,y1, 'k'), grid
ylabel('Y(t)')
xlabel('Tempo(s)')