Asignatura:: Análisis de Circuitos Eléctricos
Asignatura:: Análisis de Circuitos Eléctricos
Asignatura:: Análisis de Circuitos Eléctricos
ELABORADO POR:
GABRIEL MALLA
TUTOR:
KATYA TORRES
NRC:
7812
TEMA:
FECHA DE ENTREGA:
30/7/20
function varargout = Circuits(varargin)
% CIRCUITS MATLAB code for Circuits.fig
% CIRCUITS, by itself, creates a new CIRCUITS or raises the existing
% singleton*.
%
% H = CIRCUITS returns the handle to a new CIRCUITS or the handle to
% the existing singleton*.
%
% CIRCUITS('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CIRCUITS.M with the given input
arguments.
%
% CIRCUITS('Property','Value',...) creates a new CIRCUITS or raises
the
% existing singleton*. Starting from the left, property value pairs
are
% applied to the GUI before Circuits_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property
application
% stop. All inputs are passed to Circuits_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
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 Circuits is made visible.
function Circuits_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% 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 Circuits (see VARARGIN)
% --- Outputs from this function are returned to the command line.
function varargout = Circuits_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)
end
%EJECUTAR
% --- Executes on button press in pushbutton4.
alpha=(R)/(2*L);
Wo=(1)/((L*C)^(1/2));
%s1=(-alpha+(alpha^2-Wo^2)^(1/2));
%s2=(-alpha-(alpha^2-Wo^2)^(1/2));
set(handles.edit7,'String',alpha);
set(handles.edit8,'String',Wo);
%set(handles.pu,'String',real(s1));
%set(handles.edit17,'String',imag(s1));
A2=((a2/C)-(a1*s1)+(F*s1))/(-s1+s2);
A1=a1-F-A2;
B1=R/L;
C1=1/(L*C);
mss=['[d^2v/dt^2]+',num2str(B1),'[dv/dt]+',num2str(C1),'v=',num2str(C1*F)
];
set(handles.edit10,'String',mss);
mss1=['v(t)=[',num2str(A1),']exp(',num2str(s1),'t)+[',num2str(A2),']exp('
,num2str(s2),'t)+',num2str(F)];
set(handles.edit11,'String',mss1);
t=0:0.02:20;
v=A1.*exp(s1*t)+A2.*exp(s2*t)+F;
plot(handles.axes10,t,v);
grid on
end
if(alpha == Wo)
%Criticamente amortiguado
Tip='C. Críticamente Amortiguado';
set(handles.edit9,'String',Tip);
alpha=(R)/(2*L);
A1=a1-F;
A2=(a2/C)+(alpha*a1)-(alpha*F);
B1=R/L;
C1=1/(L*C);
mss=['[d^2v/dt^2]+',num2str(B1),'[dv/dt]+',num2str(C1),'v=',num2str(C1*F)
];
set(handles.edit10,'String',mss);
mss1=['v(t)=[',num2str(A1),'+(',num2str(A2),')t]exp(',num2str(-
alpha),'t)+',num2str(F)];
set(handles.edit11,'String',mss1);
t= 0:0.02:20;
v=((A1.*exp(-1*alpha*t))+(A2*t.*exp(-1*alpha*t))+F);
plot(handles.axes10,t,v);
grid on
end
if (alpha < Wo)
%Subamortiguado
Tip='Circuito Subamortiguado';
set(handles.edit9,'String',Tip);
alpha=(R)/(2*L);
Wd=(Wo^2-alpha^2)^(1/2);
A1=a1-F;
A2=((a2/C)+(alpha*A1))/(Wd);
B1=R/L;
C1=1/(L*C);
mss=['[d^2v/dt^2]+',num2str(B1),'[dv/dt]+',num2str(C1),'v=',num2str(C1*F)
];
set(handles.edit10,'String',mss);
mss1=['v(t)=[[',num2str(A1),']cos(',num2str(Wd),'t)+[',num2str(A2),']sin(
',num2str(Wd),'t)].*exp(-',num2str(alpha),')+',num2str(F)];
set(handles.edit11,'String',mss1);
t=a0:0.02:20;
v=A1*cos(Wd*t).*exp(-alpha*t)+A2*sin(Wd*t).*exp(-alpha*t)+F;
plot(handles.axes10,t,v);
grid on
end
guidata(hObject, handles);
alpha=(1)/(2*R*C);
Wo=(1)/((L*C)^(1/2));
s1=(-alpha+(alpha^2-Wo^2)^(1/2));
s2=(-alpha-(alpha^2-Wo^2)^(1/2));
set(handles.edit7,'String',alpha);
set(handles.edit8,'String',Wo);
set(handles.pu,'String',real(s1));
set(handles.edit17,'String',imag(s1));
if (alpha > Wo)
%sobreamortiguado
alpha=(1)/(2*R*C);
Wo=(1)/((L*C)^(1/2));
Tip='Circuito Sobreamortiguado';
set(handles.edit9,'String',Tip);
s1=(-alpha+(alpha^2-Wo^2)^(1/2));
s2=(-alpha-(alpha^2-Wo^2)^(1/2));
A2=((a1/L)-(s1*a2)+(F*s1))/(-s1+s2);
A1=a2-F-A2;
B1=1/(R*C);
C1=1/(L*C);
mss=['[d^2i/dt^2]+',num2str(B1),'[di/dt]+',num2str(C1),'i=',num2str(C1*F)
];
set(handles.edit10,'String',mss);
mss1=['i(t)=[',num2str(A1),']exp(',num2str(s1),'t)+[',num2str(A2),']exp('
,num2str(s2),'t)+',num2str(F)];
set(handles.edit11,'String',mss1);
t=a1:0.02:20;
i=A1.*exp(s1*t)+A2.*exp(s2*t)+F;
plot(handles.axes10,t,i);
grid on
end
if(alpha == Wo)
%Criticamente amortiguado
Tip='C. Críticamente Amortiguado';
set(handles.edit9,'String',Tip);
alpha=(1)/(2*R*C);
A2=(a1/L)+(alpha*a2)-(alpha*F);
A1=a2-F;
B1=1/(R*C);
C1=1/(L*C);
mss=['[d^2i/dt^2]+',num2str(B1),'[di/dt]+',num2str(C1),'i=',num2str(C1*F)
];
set(handles.edit10,'String',mss);
mss1=['i(t)=[',num2str(A1),'+(',num2str(A2),')t]exp(',num2str(-
alpha),'t)+',num2str(F)];
set(handles.edit11,'String',mss1);
t=a1:0.02:20;
i=((A1)*(exp(-(alpha)*t)))+((A2*t)*(exp(-(alpha)*t)))+F;
plot(handles.axes10,t,i);
grid on
end
if (alpha < Wo)
%Subamortiguado
Tip='Circuito Subamortiguado';
set(handles.edit9,'String',Tip);
alpha=(1)/(2*R*C);
Wd=(Wo^2-alpha^2)^(1/2);
A1=a2-F;
A2=((a1/L)+(alpha*A1))/(Wd);
B1=1/(R*C);
C1=1/(L*C);
mss=['[d^2i/dt^2]+',num2str(B1),'[di/dt]+',num2str(C1),'i=',num2str(C1*F)
];
set(handles.edit10,'String',mss);
mss1=['i(t)=[[',num2str(A1),']cos(',num2str(Wd),'t)+[',num2str(A2),']sin(
',num2str(Wd),'t)].*exp(-',num2str(alpha),')+',num2str(F)];
set(handles.edit11,'String',mss1);
t=0:0.02:20;
i=(A1*cos(Wd*t).*exp(-alpha*t))+(A2*sin(Wd*t).*exp(-
alpha*t))+F;
plot(handles.axes10,t,i);
grid on
end
guidata(hObject, handles);