Vous êtes sur la page 1sur 13

GRÁFICA DE CORRIENTE A PARTIR DE GRÁFICA DE FLUJO VS TIEMPO Y FLUJO VS

CORRIENTE

Integrantes:

José Daniel Rodríguez Pineda – Cód. 20161007050


Jaiver David Galeano Cabrera – Cód. 20162007903

Fig 1. Interfaz gráfica MatLab

Fig 2. Zona de selección de datos


Fig 3. Onda Seno y Ciclo de Histeresis Convencional

Fig 3. Onda Seno y Ciclo de Histeresis Rombo


Fig 4. Onda Seno y Ciclo de Histeresis Lineal

Fig 5. Onda Seno y Ciclo de Histeresis Lineal

Código montado en Matlab

function varargout = Corriente(varargin)


% CORRIENTE MATLAB code for Corriente.fig
% CORRIENTE, by itself, creates a new CORRIENTE or raises the
existing
% singleton*.
%
% H = CORRIENTE returns the handle to a new CORRIENTE or the handle
to
% the existing singleton*.
%
% CORRIENTE('CALLBACK',hObject,eventData,handles,...) calls the
local
% function named CALLBACK in CORRIENTE.M with the given input
arguments.
%
% CORRIENTE('Property','Value',...) creates a new CORRIENTE or
raises the
% existing singleton*. Starting from the left, property value pairs
are
% applied to the GUI before Corriente_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property
application
% stop. All inputs are passed to Corriente_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

% Edit the above text to modify the response to help Corriente

% Last Modified by GUIDE v2.5 11-Sep-2019 12:27:45

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Corriente_OpeningFcn, ...
'gui_OutputFcn', @Corriente_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

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 Corriente is made visible.


function Corriente_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 Corriente (see VARARGIN)

% Choose default command line output for Corriente


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);
% UIWAIT makes Corriente wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = Corriente_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)

% Get default command line output from handles structure


varargout{1} = handles.output;

function edit1_Callback(hObject, eventdata, handles)


% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit1 as text


% str2double(get(hObject,'String')) returns contents of edit1 as a
double

% --- Executes during object creation, after setting all properties.


function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit2_Callback(hObject, eventdata, handles)


% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit2 as text


% str2double(get(hObject,'String')) returns contents of edit2 as a
double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes during object creation, after setting all properties.


function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: popupmenu controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit3_Callback(hObject, eventdata, handles)


% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit3 as text


% str2double(get(hObject,'String')) returns contents of edit3 as a
double

% --- Executes during object creation, after setting all properties.


function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit4 as text


% str2double(get(hObject,'String')) returns contents of edit4 as a
double

% --- Executes during object creation, after setting all properties.


function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit5_Callback(hObject, eventdata, handles)


% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit5 as text


% str2double(get(hObject,'String')) returns contents of edit5 as a
double

% --- Executes during object creation, after setting all properties.


function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit6 as text


% str2double(get(hObject,'String')) returns contents of edit6 as a
double

% --- Executes during object creation, after setting all properties.


function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit7_Callback(hObject, eventdata, handles)


% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit7 as text


% str2double(get(hObject,'String')) returns contents of edit7 as a
double

% --- Executes during object creation, after setting all properties.


function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function popupmenu1_Callback(hObject, eventdata, handles)


function popupmenu2_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


function popupmenu2_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: popupmenu controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit8_Callback(hObject, eventdata, handles)


% hObject handle to edit8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit8 as text


% str2double(get(hObject,'String')) returns contents of edit8 as a
double

% --- Executes during object creation, after setting all properties.


function edit8_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit9_Callback(hObject, eventdata, handles)


% hObject handle to edit9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit9 as text


% str2double(get(hObject,'String')) returns contents of edit9 as a
double
% --- Executes during object creation, after setting all properties.
function edit9_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit10_Callback(hObject, eventdata, handles)


% hObject handle to edit10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit10 as text


% str2double(get(hObject,'String')) returns contents of edit10 as
a double

% --- Executes during object creation, after setting all properties.


function edit10_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit11_Callback(hObject, eventdata, handles)


% hObject handle to edit11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit11 as text


% str2double(get(hObject,'String')) returns contents of edit11 as
a double
% --- Executes during object creation, after setting all properties.
function edit11_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit12_Callback(hObject, eventdata, handles)


% hObject handle to edit12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit12 as text


% str2double(get(hObject,'String')) returns contents of edit12 as
a double

% --- Executes during object creation, after setting all properties.


function edit12_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit13_Callback(hObject, eventdata, handles)


% hObject handle to edit13 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit13 as text


% str2double(get(hObject,'String')) returns contents of edit13 as
a double

% --- Executes during object creation, after setting all properties.


function edit13_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit13 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in pushbutton1.


function pushbutton1_Callback(hObject, eventdata, handles)
f=str2double(get(handles.edit5,'String'));
fm=str2double(get(handles.edit4,'String'));
lm=str2double(get(handles.edit13,'String'));
n=str2double(get(handles.edit9,'String'));
x=linspace(0,2*pi*f);
x1=linspace(-lm/n,lm/n);
v=get(handles.popupmenu1,'Value');
switch v
case 1
y=fm*sin(x/f); %Grafica del Seno
axes(handles.axes1);
plot(x,y);
case 2 %Grafica del triangulo

y2=((x>0)&(x<pi*f/2)).*(2*fm*x/(pi*f))+((x>pi*f/2)&(x<1.5*pi*f)).*(2*fm-
2*fm*x/(pi*f))+((x>pi*f*1.5)&(x<2*pi*f)).*(2*fm*x/(pi*f)-4*fm);
axes(handles.axes1);
plot(x,y2);
end
v2=get(handles.popupmenu2,'Value');
switch v2 %acá empieza
case 1 % Culebrita
y3=((x1>-0.2*lm/n)&(x1<lm/n)).*(fm*(1-exp(-
4*(x1+0.2*(lm/2)))))+((x1>-lm/n)&(x1<-0.2*lm/n)).*(fm*(-
1+exp(4*(x1+0.2*(lm/2)))));
axes(handles.axes2);
plot(x1,y3);
hold on
y9=((x1>0.2*lm/n)&(x1<lm/n)).*(fm*(1-exp(-4*(x1-
0.2*(lm/2)))))+((x1>-lm/n)&(x1<0.2*lm/n)).*(fm*(-1+exp(4*(x1-
0.2*(lm/2)))));
plot(x1,y9);
hold off
switch v
case 1 %Seno
y7=((x>0)&(x<pi*f/2)).*(-((log(1-sin(x/f)))-
0.2*lm/n)/4)+((x>pi*f/2)&(x<pi*f)).*(-((log(1-
sin(x/f)))+0.2*lm/n)/4)+((x>pi*f)&(x<3*pi*f/2)).*(((log(1+sin(x/f)))+0.2*
lm/n)/4)+((x>3*pi*f/2)&(x<2*pi)).*(((log(1+sin(x/f)))-
0.2*lm/n)/4)+((x>(3/2)*pi*f)&(x<2*pi*f)).*(1/4*((log(1+sin(x/f)))-
0.2*lm/n));
axes(handles.axes3);
plot(x,y7);
case 2 %triangulo
y8=((x>0)&(x<pi*f/2)).*(((((2*fm)/(n*fm))*x-
fm)*lm)/(n*fm))-((x>f*pi/2)&(x<pi*f)).*(((2*fm-(((2*fm)/(n*fm))*x)-
fm)*lm)/(n*fm))+((x>pi*f)&(x<3*pi*f/2)).*(((2*fm-(((2*fm)/(n*fm))*x)-
fm)*lm)/(n*fm))-((x>(3/2)*pi)&(x<2*pi*f)).*(((-
4*fm+(((2*fm)/(n*fm))*x)+fm)*lm)/(n*fm));
axes(handles.axes3);
plot(x,y8);
end
case 2 %rombo
y4=((x1>-lm/n)&(x1<0)).*((n*fm*x1/lm)+fm)+((x1>0)&(x1<lm/n)).*((-
n*fm*x1/lm)+fm);
y5=((x1>-lm/n)&(x1<0)).*((-n*fm*x1/lm)-
fm)+((x1>0)&(x1<lm/n)).*((n*fm*x1/lm)-fm);
axes(handles.axes2);
plot(x1,y4);
hold on
plot(x1,y5);
hold off
switch v
case 1 %seno
y7=((x>0)&(x<pi*f/2)).*(((fm*(sin(x/f))-fm)*lm)/(n*fm))-
((x>pi*f/2)&(x<pi*f)).*(((fm*(sin(x/f))-
fm)*lm)/(n*fm))+((x>pi*f)&(x<3*pi*f/2)).*(((fm*(sin(x/f))+fm)*lm)/(n*fm))
-((x>3*pi*f/2)&(x<2*pi)).*(((fm*(sin(x/f))-fm)*lm)/(n*fm))-
((x>(3/2)*pi*f)&(x<2*pi*f)).*(((fm*(sin(x/f))+fm)*lm)/(n*fm));
axes(handles.axes3);
plot(x,y7);
case 2 %triangulo
y8=x;
axes(handles.axes3);
plot(x,y8);
end
case 3 %linea
y6=((x1>-lm/n)&(x1<lm/n)).*(fm*x1/lm); %Intervalo y funcion
axes(handles.axes2);
plot(x1,y6);
switch v
case 1 %seno
y7=(fm*sin(x/f));
axes(handles.axes3);
plot(x,y7);
case 2 %triangulo

y8=((x>0)&(x<pi*f/2)).*(2*fm*x/(pi*f))+((x>pi*f/2)&(x<1.5*pi*f)).*(2*fm-
2*fm*x/(pi*f))+((x>pi*f*1.5)&(x<2*pi*f)).*(2*fm*x/(pi*f)-4*fm);
axes(handles.axes3);
plot(x,y8);
end
end

Vous aimerez peut-être aussi