Contents

% Raquel Fernandez Gomez

EJERCICIO 4 %%%

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

% Last Modified by GUIDE v2.5 12-Jan-2019 17:10:26

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @Prototipo_gui_OpeningFcn, ...
                   'gui_OutputFcn',  @Prototipo_gui_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 Prototipo_gui is made visible.
function Prototipo_gui_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 Prototipo_gui (see VARARGIN)

% Choose default command line output for Prototipo_gui
handles.output = hObject;


% Update handles structure
guidata(hObject, handles);

% UIWAIT makes Prototipo_gui wait for user response (see UIRESUME)
% uiwait(handles.figure1);


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


% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject    handle to barra (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,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider


% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to barra (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end



function a_Callback(hObject, eventdata, handles)
% hObject    handle to a (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 a as text
%        str2double(get(hObject,'String')) returns contents of a as a double


% --- Executes during object creation, after setting all properties.
function a_CreateFcn(hObject, eventdata, handles)
% hObject    handle to a (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 to_Callback(hObject, eventdata, handles)
% hObject    handle to to (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 to as text
%        str2double(get(hObject,'String')) returns contents of to as a double


% --- Executes during object creation, after setting all properties.
function to_CreateFcn(hObject, eventdata, handles)
% hObject    handle to to (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 peso_Callback(hObject, eventdata, handles)
% hObject    handle to peso (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 peso as text
%        str2double(get(hObject,'String')) returns contents of peso as a double


% --- Executes during object creation, after setting all properties.
function peso_CreateFcn(hObject, eventdata, handles)
% hObject    handle to peso (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 hmin_Callback(hObject, eventdata, handles)
% hObject    handle to hmin (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 hmin as text
%        str2double(get(hObject,'String')) returns contents of hmin as a double


% --- Executes during object creation, after setting all properties.
function hmin_CreateFcn(hObject, eventdata, handles)
% hObject    handle to hmin (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 flecha_Callback(hObject, eventdata, handles)
% hObject    handle to flecha (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 flecha as text
%        str2double(get(hObject,'String')) returns contents of flecha as a double


% --- Executes during object creation, after setting all properties.
function flecha_CreateFcn(hObject, eventdata, handles)
% hObject    handle to flecha (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 longitud_Callback(hObject, eventdata, handles)
% hObject    handle to longitud (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 longitud as text
%        str2double(get(hObject,'String')) returns contents of longitud as a double


% --- Executes during object creation, after setting all properties.
function longitud_CreateFcn(hObject, eventdata, handles)
% hObject    handle to longitud (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)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
a = eval(get(handles.a,'String'));
vano=eval(get(handles.a,'String'));
tension=eval(get(handles.to,'String'));
peso=eval(get(handles.peso,'String'));
hmin=eval(get(handles.hmin,'String'));
x=linspace(0,vano);
h=(tension/peso)*(cosh(peso*vano/(2*tension))-1);
l=(tension/peso)*(sinh((peso*vano)/(tension)));
y=(tension./peso).*(cosh((peso.*(2.*x-vano))./(2.*tension))-cosh((peso.*vano)./(2.*tension)))+h+hmin;

plot(x,y)
ylim([0,max(y)*1.2]);

set(handles.flecha,'String',h);
set(handles.long,'String',l);







% --- Executes on slider movement.
function barra_Callback(hObject, eventdata, handles)
% hObject    handle to barra (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
s=get(handles.barra,'Value');
set(handles.a,'String',s);



% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider


% --- Executes during object creation, after setting all properties.
function barra_CreateFcn(hObject, eventdata, handles)
% hObject    handle to barra (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end
Error using load
Unable to read file 'Ejercicio4.fig': no such file or directory.

Error in graphics.internal.figfile.FigFile/read (line 27)
    hgDataVars = load(filename, '-mat', '-regexp', '^hg[S]');

Error in graphics.internal.figfile.FigFile (line 104)



Error in hgload (line 45)



Error in matlab.hg.internal.openfigLegacy (line 57)
    [fig, savedvisible] = hgload(filename, struct('Visible','off'));

Error in gui_mainfcn>local_openfig (line 286)
    gui_hFigure = matlab.hg.internal.openfigLegacy(name, singleton, visible);  

Error in gui_mainfcn (line 158)
        gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt, gui_Visible);

Error in Ejercicio4 (line 46)
    gui_mainfcn(gui_State, varargin{:});