Está en la página 1de 4

EJEMPLOREALIZADO

BORRADO DE BARIABLES

clear all
clc

PARAMETROS DEL PROCESO NO LINEAL (TABLA 3.3)

JL = 3.5e-7; bL = 1e-5; Ro = 0.01; Lo = 0.776;


Jm = 1.9062e-6; bm = 1.8338e-6; g = 9.81;
E = 31.035e-3; R = 7.38; m = 0.06377;
Kact = 14.9; cc = 0.25; Mo = 0.045; % 0, 0.01, 0.02
K = 31.071e-3; n = 19.741; L = 4.64e-2;
B = n^2*bm + bL;
Jeff = n^2*Jm +JL;
M = Jeff + (1/3)*m*Lo^2 + Mo*Lo^2 + (2/5)*Mo*Ro^2;
N = g*Lo*(Mo+m/2);

MODELO NO LINEAL DEL PROCESO CONTINUO DE SEGUNDO ORDEN

Ac = [0 1;-N/M -(B + n^2*K*E/R)/M];


Bc = [0;n*K*Kact/(R*M)];
Cc = [1 0]; Dc = [0];

MODELO LINEAL DISCRETO DEL PROCESO DE SEGUNDO ORDEN

T = 0.01; % PERIODO DE MUESTREO


[G,H,C,D]=c2dm(Ac,Bc,Cc,Dc,T,'zoh');
[num,den]=ss2tf(G,H,C,D);
a1 = den(2); a2 = den(3); b1 = num(2); b2 = num(3);

CONDICIONES INICIALES NULAS

q(1)=0; q(2)=0; q(3)=0;


u(1)=0; u(2)=0; u(3)=0;
y(1)=0; y(2)=0; y(3)=0;
e(1)=0; e(2)=0; e(3)=0;

RESPUESTAS DEL PROCESO

MM = 1000;
for t=3:MM+2
u(t) = sin(0.006*t); % SINUSOIDE DE ENTRADA
q(t+1) = -a1*q(t) -a2*q(t-1) + b1*u(t) + b2*u(t-1);
e(t+1) = 0.1*randn; % GENERA RUIDO BLANCO GAUSSIANO
% DE MEDIA NULA Y VARIANZA 0.1
y(t+1) = (1-a1)*y(t) + (a1-a2)*y(t-1) + a2*y(t-2) ...
+ b1*u(t) + (b2-b1)*u(t-1) - b2*u(t-2) ...
+ e(t+1) + a1*e(t) + a2*e(t-1);
end

GRAFICOS

ejex = linspace(0,MM*T,MM);
figure(1)
subplot(2,1,1)
plot(ejex,q(3:MM+2)); grid
ylabel('Posicion en rad');
xlabel('Tiempo en segundos')
subplot(2,1,2)
plot(ejex,u(3:MM+2)); grid
ylabel('Entrada (voltios)')
xlabel('Tiempo en segundos')
print -f -deps ejem6_2a

figure(2)
subplot(2,1,1)
plot(ejex,y(3:MM+2)); grid
ylabel('Posicion ruidosa (rad)');
xlabel('Tiempo en segundos')
subplot(2,1,2)
plot(ejex,u(3:MM+2)); grid
ylabel('Entrada (voltios)')
xlabel('Tiempo en segundos')
print -f -deps ejem6_2b

figure(3)
subplot(2,1,1)
plot(ejex,e(3:MM+2)); grid
ylabel('Ruido gaussiano e(t) (rad)')
xlabel('Tiempo en segundos')
subplot(2,1,2)
hist(e)
ylabel('Distribucion de e(t)')
xlabel('<------ e(t) ------>')
print -f -deps ejem6_2c
Published with MATLAB R2013a

También podría gustarte