Está en la página 1de 2

Matlab for dummies Laplace

% N polinomio Numerador de H(s)


% D polinomio denominador de H(s)

N=[1 0]
D=[1 1 1]

% Ceros: raices del numerador


roots(N)

% Polos: raices del denominador


roots(D)

% funci�n transferencia
H=tf[N,D]

% Antitransformada de Laplace
% atenci�n hay que reescribir H (sacar los caracteres especiales por ejemplo la
raya)

ht=ilaplace(H)

% respuesta al impulso = ht
% graficar
%atenci�n hay que definir siempre el rango de abscisas mayor que cero

ezplot(ht,[0,XMAX])

% help ezplot por ej. y=f(x)


% ezplot(FUN2,[XMIN,XMAX,YMIN,YMAX]) plots FUN2(X,Y) = 0 over XMIN < X < XMAX and
YMIN < Y < YMAX.

% respuesta al impulso
d=impulse(H);

% respuesta al escalon
u=step(H);

% graficar
plot(u)

% respuesta en frecuencia (grafica autom�ticamente)


bode(H)

%generaci�n de ondas para simular


[U,T] = gensig(TYPE,TAU) generates a scalar signal U of class TYPE
and period TAU. The following classes are supported:
TYPE = 'sin' --- sine wave
TYPE = 'square' --- square wave
TYPE = 'pulse' --- periodic pulse
gensig returns a vector T of time samples and the vector U of signal
values at these samples. All generated signals have unit amplitude.

[U,T] = gensig(TYPE,TAU,TF,TS) further specifies the time duration TF


of the signal and the spacing TS of the time samples in T.

% por ej: [u,t]=gensig('square',4,10,0.1);


onda cuadrada de per�odo 4, duraci�n 10, muestreo cada 0.1
% para graficar

lsim(H,u,t)

% grilla en gr�ficos
grid on
grid off

% math Simb�lica
syms s
%Plantear ecuaciones de nodos o mallas con la variable s
% despu�s resolver por matrices un circuito

% ra�ces del polinomio


roots(D)

También podría gustarte