0% found this document useful (0 votes)
12 views11 pages

Circulo de mohr codigo

The document contains MATLAB code for a graphical user interface (GUI) named 'circulodemohr', which is designed to perform calculations related to Mohr's Circle. It includes functions for initializing the GUI, handling user inputs for stress components, and plotting the results on a circle. The code also contains callbacks for various UI elements that allow users to input values and visualize the output graphically.

Uploaded by

ivan.urbina2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views11 pages

Circulo de mohr codigo

The document contains MATLAB code for a graphical user interface (GUI) named 'circulodemohr', which is designed to perform calculations related to Mohr's Circle. It includes functions for initializing the GUI, handling user inputs for stress components, and plotting the results on a circle. The code also contains callbacks for various UI elements that allow users to input values and visualize the output graphically.

Uploaded by

ivan.urbina2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

function varargout = circulodemohr(varargin)

% CIRCULODEMOHR MATLAB code for circulodemohr.fig

% CIRCULODEMOHR, by itself, creates a new CIRCULODEMOHR or raises the


existing

% singleton*.

% H = CIRCULODEMOHR returns the handle to a new CIRCULODEMOHR or the


handle to

% the existing singleton*.

% CIRCULODEMOHR('CALLBACK',hObject,eventData,handles,...) calls the local

% function named CALLBACK in CIRCULODEMOHR.M with the given input


arguments.

% CIRCULODEMOHR('Property','Value',...) creates a new CIRCULODEMOHR or


raises the

% existing singleton*. Starting from the left, property value pairs are

% applied to the GUI before circulodemohr_OpeningFcn gets called. An

% unrecognized property name or invalid value makes property application

% stop. All inputs are passed to circulodemohr_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 circulodemohr


% Last Modified by GUIDE v2.5 06-Jan-2025 20:07:50

% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename, ...

'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @circulodemohr_OpeningFcn, ...

'gui_OutputFcn', @circulodemohr_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 circulodemohr is made visible.

function circulodemohr_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 circulodemohr (see VARARGIN)

% Choose default command line output for circulodemohr

handles.output = hObject;

% Update handles structure

guidata(hObject, handles);

% UIWAIT makes circulodemohr wait for user response (see UIRESUME)

% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.

function varargout = circulodemohr_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 esfuerzox_Callback(hObject, eventdata, handles)

% hObject handle to esfuerzox (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 esfuerzox as text

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

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

function esfuerzox_CreateFcn(hObject, eventdata, handles)

% hObject handle to esfuerzox (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 esfuerzoy_Callback(hObject, eventdata, handles)


% hObject handle to esfuerzoy (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 esfuerzoy as text

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

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

function esfuerzoy_CreateFcn(hObject, eventdata, handles)

% hObject handle to esfuerzoy (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 taoxy_Callback(hObject, eventdata, handles)

% hObject handle to taoxy (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 taoxy as text

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

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

function taoxy_CreateFcn(hObject, eventdata, handles)

% hObject handle to taoxy (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 angulo_Callback(hObject, eventdata, handles)

% hObject handle to angulo (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 angulo as text

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

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

function angulo_CreateFcn(hObject, eventdata, handles)

% hObject handle to angulo (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)

esx = str2num(get(handles.esfuerzox,'string'));

esy = str2num(get(handles.esfuerzoy,'string'));

txy = str2num(get(handles.taoxy,'string'));
txyp = txy

txyn = -txy

angulo = str2num(get(handles.angulo,'string'));

r = (sqrt(((esy-esx)^2)+((txyn-txyp)^2)))/2;

tmax = r

set(handles.tmax, 'string', num2str(tmax))

ca = sqrt(r^2 - txy^2)

dorce = ca + esx

set(handles.d, 'string', num2str(dorce))

esfuerzo1 = r + dorce;

esfuerzo2 = dorce - r;

set(handles.esf1, 'string', num2str(esfuerzo1))

set(handles.esf2, 'string', num2str(esfuerzo2))

dtta = rad2deg(atan((txy)/(ca)))

set(handles.angori, 'string', num2str(dtta))

anguloori = dtta/2

set(handles.theta, 'string', num2str(anguloori))

x = 2 * angulo;

esfuerzos = (cosd(x));

taoform = (sind(x));

sigpri1 = (esx+esy)/2 + ((esx-esy)/2) * esfuerzos + txy * taoform

sigpri2 = (esx+esy)/2 - ((esx-esy)/2) * esfuerzos - txy * taoform;

txyprima = -((esx-esy)/2)*sind(2*angulo) + txy*cosd(2*angulo);


txyprimap = txyprima

txypriman = -txyprima

set(handles.esxprima, 'string', num2str(sigpri1));

set(handles.esyprima, 'string', num2str(sigpri2));

set(handles.txyprima, 'string', num2str(txyprima));

%circunferencia

xc = dorce

yc = 0

theta = linspace(0, 2*pi);

x=r*cos(theta)+xc

y=r*sin(theta)+yc

plot(x,y);

a = [-200 200]

b = a-a

hold on

plot(a,b,'k-');

plot(b,a,'k-');

puntoA = [esy,esx]

puntoB = [txyp,txyn]

plot(esy,txyp, 'ko');

plot(esx,txyn, 'ko');

plot(dorce, 0, 'ko');

plot(puntoA, puntoB, '-', 'LineWidth', 2);

plot(esfuerzo1, 0, 'mo')

plot(esfuerzo2, 0, 'mo')
puntoAp = [sigpri1,sigpri2]

puntoBp = [txypriman,txyprimap]

plot(sigpri2,txyprimap, 'ko');

plot(sigpri1,txypriman, 'ko');

plot(puntoAp, puntoBp, '-', 'LineWidth', 2);

hold off

grid on;

function tmax_Callback(hObject, eventdata, handles)

% hObject handle to tmax (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 tmax as text

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

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

function tmax_CreateFcn(hObject, eventdata, handles)

% hObject handle to tmax (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

You might also like