Documentos de Académico
Documentos de Profesional
Documentos de Cultura
INFORME # 2
Función desplazamiento
function[y,n]= sigshift(x,m,n0)
n =m-n0; y=x;
Función inversión
y = fliplr(x)
n=-fliplr(n)
Función escalamiento
function[y,n]= escale(x,m,p)
n =m*(1/p); y=x;
function[y,n]= sigadd(x1,n1,x2,n2)
%implementación de la función y =x1(n)+x2(n)
n = min(min(n1),min(n2)):max(max(n1),max(n2))
y1 =zeros(1,length(n))
y2 = zeros(1,length(n))
y1(find(((n>=min(n1))&(n<=max(n1))==1)))=x1
y2(find (((n>=min(n2))&(n<=max(n2))==1)))=x2
y = y1+y2
1. Para la señal de la figura obtener las siguientes transformaciones de
la variable independiente
a. X(t-2)
b. X(t+2)
c. X(-t)
d. X(2t)
Función a graficar
t=-5:0.001:5
x= stepcont(-2,-5,5)
plot(t,x)
a. Señal x(t-2)
t=-5:0.001:5
x= stepcont(-2,-5,5)
[x1,t1]= sigshift(x,t,-2)
plot(t1,x1)
b. Señal x(t+2)
t=-5:0.001:5
x= stepcont(-2,-5,5)
[x1,t1]= sigshift(x,t,2)
plot(t1,x1)
c. X(-t)
t=-5:0.001:5
x= stepcont(-2,-5,5)
[x1,t1]= sigfold(x,t)
plot(t1,x1)
d. X(2t)
t=-5:0.001:5
x= stepcont(-2,-5,5)
[x1,t1]= escale(x,t,2)
plot(t1,x1)
2. Utilizando el comando subplot dibujar en una sola grafica, utilizando
el comando title poner los títulos respectivos a cada grafica.
t=-5:0.001:5
x= stepcont(-2,-5,5)
[x1,t1]= sigshift(x,t,-2)
subplot(2,2,1), plot(t1,x1);axis([-5 5 -1 2]);
title x(t-2)
grid on
t=-5:0.001:5
x= stepcont(-2,-5,5)
[x1,t1]= sigshift(x,t,2)
subplot(2,2,2), plot(t1,x1);axis([-5 5 -1 2]);
title x(t+2)
grid on
t=-5:0.001:5
x= stepcont(-2,-5,5)
[x1,t1]= sigfold(x,t)
subplot(2,2,3), plot(t1,x1);axis([-5 5 -1 2]);
title x(-t)
grid on
t=-5:0.001:5
x= stepcont(-2,-5,5)
[x1,t1]= escale(x,t,2)
subplot(2,2,4), plot(t1,x1);axis([-5 5 -1 2]);
title x(2t)
grid on
t=-5:0.001:5
x= stepcont(-2,-5,5)
[x1,t1]= sigfoldi(x,t)
plot(t1,x1)
grid on
n=-5:1:5
x= stepseq(-2,-5,5)
n=-5:1:5
x= stepseq(-2,-5,5)
[x1,n1]= sigshift(x,n,-2)
stem(n1,x1)
n=-5:1:5
x= stepseq(-2,-5,5)
[x1,n1]= sigshift(x,n,2)
stem(n1,x1)
n=-5:1:5
x= stepseq(-2,-5,5)
[x1,n1]= sigfold(x,n)
stem(n1,x1)
n=-5:1:5
x= stepseq(-2,-5,5)
[x1,n1]= escale(x,n,2)
stem(n1,x1)
a. ;
b. ;
c.
d. La energía total disipada en la resistencia de
La energía disipada es
% Voltaje de salida
% B= amplitud
% a= valor del exponente
% tiempo
B=60;
a=25;
t=0:0.001:1;
x=B*exp(-a*t);
plot(t,x)
% Corriente de salida
% B= amplitud
% a= valor del exponente
% tiempo
B=60;
a=25;
t=0:0.001:1;
x=B*exp(-a*t);
plot(t,x)
8. Obtener
a. X(-t)
t=-5:0.001:5
B=1;
a=25;
t=0:0.001:1;
x=B*exp(-a*t);
[x1,t1]= sigfold(x,t)
plot(t1,x1)
title x(-t)
b. X(t-2)
t=-5:0.001:5
B=1;
a=25;
t=0:0.001:1;
x=B*exp(-a*t);
[x1,t1]= sigshift(x,t,-2)
plot(t1,x1)
title x(t-2)
c. X(-t+3)
t=-5:0.001:5
B=1;
a=25;
t=0:0.001:1;
x=B*exp(-a*t);
[x1,t1]= sigshift(x,-t,3)
plot(t1,x1)
title x(-t+3)
d. X(t/2)
t=-5:0.001:5
B=1;
a=25;
t=0:0.001:1;
x=B*exp(-a*t);
[x1,t1]= escale(x,t,1/2)
plot(t1,x1)
title x(t/2)
9. Visitar el siguiente enlace, descargar el programa y crear un ejemplo
propio que utilice todas las opciones
http://www.matpic.com/MATLAB/MATLAB_OOS.html
FUNCION OOS
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
axes(handles.axes1)
plot(t,sin(2*pi*4*t),'LineWidth',1.5)
axis([-1 1 -1.5 1.5])
grid on
axes(handles.axes2)
plot(t,sin(2*pi*8*t),'LineWidth',1.5)
axis([-1 1 -1.5 1.5])
grid on
handles.out1=sin(2*pi*5*t);
handles.out2=sin(2*pi*8*t);
handles.out11=sin(2*pi*5*t);
axes(handles.axes3)
handles.result=handles.out1+handles.out2;
plot(t,handles.result,'LineWidth',1.5,'Color','r')
grid on
axis([-1 1 -2.5 2.5])
set(handles.amplitude,'Value',0.5);
set(handles.time,'Value',0.5);
grid on
% Choose default command line output for OOS
handles.output = hObject;
varargout{1} = handles.output;
v=get(hObject,'Value');
if v==1
%s1
handles.out1=sin(2*pi*5*handles.t);
elseif v==2
%c1
handles.out1=cos(2*pi*4*handles.t);
elseif v==3
%u1
handles.out1=ustep(2*pi*4*handles.t);
elseif v==4
%r1
handles.out1=uramp(handles.t);
elseif v==5
%p1
handles.out1=ustep(2*pi*4*(handles.t+.5))-ustep(2*pi*4*(handles.t-0.5));
end
axes(handles.axes1)
plot(handles.t,handles.out1,'LineWidth',1.5);
axis([-1 1 -1.5 1.5])
grid on
guidata(hObject,handles)
v=get(hObject,'Value');
axes(handles.axes2)
if v==1
%s1
handles.out2=sin(2*pi*5*handles.t);
elseif v==2
%c1
handles.out2=cos(2*pi*4*handles.t);
elseif v==3
%u1
handles.out2=ustep(2*pi*4*handles.t);
elseif v==4
%r1
handles.out2=uramp(handles.t);
elseif v==5
%p1
handles.out2=ustep(2*pi*4*(handles.t+.5))-ustep(2*pi*4*(handles.t-0.5));
end
plot(handles.t,handles.out2,'LineWidth',1.5);
axis([-1 1 -1.5 1.5])
grid on
guidata(hObject,handles)
f1=1.5*get(handles.time,'Value');
a1=1.5*get(handles.amplitude,'Value');
d1=get(handles.displacement,'Value');
set(handles.lcd1,'String',a1);
axes(handles.axes3)
v=get(handles.selector1,'value');
if v==1
handles.out11=a1*sin(2*pi*5*handles.t/f1+d1);
elseif v==2
handles.out11=a1*cos(2*pi*4*handles.t/f1+d1);
elseif v==3
handles.out11=a1*ustep(2*pi*4*handles.t/f1+d1);
elseif v==4
handles.out11=a1*uramp(handles.t/f1+d1);
elseif v==5
%p1
handles.out11=a1*(ustep(2*pi*4*(handles.t+f1*.5)+d1)-
ustep(2*pi*4*(handles.t-f1*.5)+d1));
end
plot(handles.t,handles.out11,'r','LineWidth',1.5);
axis([-1 1 -2.5 2.5])
grid on
% Update handles structure
guidata(hObject, handles);
f1=1.5*get(handles.time,'Value');
a1=1.5*get(handles.amplitude,'Value');
d1=get(handles.displacement,'Value');
set(handles.lcd2,'String',f1);
axes(handles.axes3)
v=get(handles.selector1,'value');
if v==1
handles.out11=a1*sin(2*pi*5*handles.t/f1+d1);
elseif v==2
handles.out11=a1*cos(2*pi*4*handles.t/f1+d1);
elseif v==3
handles.out11=a1*ustep(2*pi*4*handles.t/f1+d1);
elseif v==4
handles.out11=a1*uramp(handles.t/f1+d1);
elseif v==5
%p1
handles.out11=a1*(ustep(2*pi*4*(handles.t+f1*.5)+d1)-
ustep(2*pi*4*(handles.t-f1*.5)+d1));
end
plot(handles.t,handles.out11,'r','LineWidth',1.5);
axis([-1 1 -2.5 2.5])
grid on
% Update handles structure
guidata(hObject, handles);
f1=1.5*get(handles.time,'Value');
a1=1.5*get(handles.amplitude,'Value');
d1=get(handles.displacement,'Value');
set(handles.lcd3,'String',d1);
axes(handles.axes3)
v=get(handles.selector1,'value');
if v==1
handles.out11=a1*sin(2*pi*5*handles.t/f1+d1);
elseif v==2
handles.out11=a1*cos(2*pi*4*handles.t/f1+d1);
elseif v==3
handles.out11=a1*ustep(2*pi*4*handles.t/f1+d1);
elseif v==4
handles.out11=a1*uramp(handles.t/f1+d1);
elseif v==5
%p1
handles.out11=a1*(ustep(2*pi*4*(handles.t+f1*.5)+d1)-
ustep(2*pi*4*(handles.t-f1*.5)+d1));
end
plot(handles.t,handles.out11,'r','LineWidth',1.5);
axis([-1 1 -2.5 2.5])
grid on
% Update handles structure
guidata(hObject, handles);
v=get(hObject,'Value');
if v==1
handles.t=sort(handles.t,'descend');
else
handles.t=sort(handles.t,'ascend');
end
axes(handles.axes3)
plot(handles.t,handles.out11,'r','LineWidth',1.5);
axis([-1 1 -2.5 2.5])
grid on
FUNCION USTEP
…………………………………..
function y=ustep(t,a)
% USTEP Unit Step Function.
%
% Y=URECT(T) generates a step function with u(0) = 1.
% Y=USTEP(T,A) generates a step function with u(0) = A.
%
% USTEP (with no input arguments) invokes the following example:
%
% % generate a DT rectangular pulse between n=3 and n=7
% >>n=0:12;
% >>yn=ustep(n-3) - ustep(n-8); % note n-8, not n-7
% >>dtplot(n,yn,'o') %plus other axis commands
%
% See Also: UDELTA, URAMP, URECT, TRI
if nargin==0,
help ustep
disp('Strike a key to see results of the example')
pause
nn=0:12;
yn=ustep(nn-3)-ustep(nn-8);
v=matver;
if v < 4, eval('clg');else,eval('clf');end
axis([0 12 0 1.5])
dtplot(nn,yn,'o')
axis([0 12 0 1.5])
hold off
return
end
if nargin == 1,
y=(t>0)+(t==0);
elseif nargin == 2,
y=(t>0)+a*(t==0);
elseif nargin > 2,
error('Too many input arguments');
end
…………………………………………..
FUNCION URAMP
function y=uramp(t)
% URAMP Unit Ramp Function.
%
% Y=URAMP(t) implements the ramp function r(t) = t*u(t)
%
% URAMP (with no input arguments) invokes the following example:
%
% % Plot a triangle between -1 and 1 with height 2
% >>t=-3:.05:3;
% >>yt=2*[uramp(t+1)-2*uramp(t)+uramp(t-1)];
% >>plot(t,yt),grid
%
% See Also: UDELTA, URECT, USTEP, TRI
if nargin==0,
help uramp
disp('Strike a key to see results of the example')
pause
t0=-3:.05:3;
yt=2*[uramp(t0+1)-2*uramp(t0)+uramp(t0-1)];
v=matver;
if v < 4, eval('clg');else,eval('clf');end
plot(t0,yt)
grid
return
end
if nargin == 1,
y=t.*(t>=0);
elseif nargin > 1,
error('Too many input arguments');
end
………………………………….
SUMA
MULTIPLICACION
SUMA
MULTIPLICACION
CONCLUSIONES:
BIBLIOGRAFIA.