Está en la página 1de 33

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

ECUACIONES DIFERENCIALES ORDINARIAS


METODO DE RUNGE KUTTA DE CUARTO ORDEN
1.- ANALISIS DEL METODO Teniendo en cuenta que los metodos estudiados para la resolucion de Ecuaciones Diferenciales Ordinarias se consideran como casos particulares de este metodo, matematicamente el de cuarto orden es mucho mas complejo, por lo cual se ha desarrollado este algoritmo luego de haber realizado ciertos procesos de tipo algebraico; para su implementacion requerimos de un unico bucle dentro del cual se realizan 24 operaciones, lo que sumado a las operaciones fuera de el, nos da un total de 24n+6 operaciones, ademas del grafico de la estructura. Los calculos realizados son simples, y se emplean funciones de sustitucion intrinsecas de MATLAB. 2.- PSEUDOCODIGO
1. 2. 3. 4. 5. 6. 7.

function [R]=rk4(f,a,b,ya,n) h=(b-a)/n; t=a:h:b; y=zeros(1,n+1); y(1)=ya; syms x for j=1:n k1=h*subs(f,x,t(j),y(j)); k2=h*subs(f,x,t(j)+h/2,y(j)+k1*h/2); k3=h*subs(f,x,t(j)+h/2,y(j)+k2*h/2); k4=h*subs(f,x,t(j)+h,y(j)+k3*h); y(j+1)=y(j)+(k1+2*k2+2*k3+k4)/6; end 8. R=[t' y']; 9. plot(R(:,1),R(:,2))

1 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

3.- EJEMPLO DE CORRIDA

2 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

4.- CONCLUSIONES

Puesto que el mtodo de Runge-Kutta de cuarto orden es el ms complejo de los estudiados, es claro que es el que mayor precisin nos brinda respecto de los dems; el costo computacional es un tanto mayor, pero damos prioridad a la precisin antes mencionada. Las soluciones obtenidas se ajustan a las expectativas planteadas al compararlas con las obtenidas al emplear funciones intrnsecas de MATLAB, pues para ciertos ejemplos son idnticas, generando un muy pequeo error en otros casos. Tomando en cuenta estos aspectos y considerando su gran utilidad en la vida prctica, consideramos al mtodo como una muy buena herramienta en diversos campos de aplicacin.

3 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

SISTEMA DE ECUACIONES ORDINARIAS MEDIANTE EL METODO DE RUNGE KUTTA DE CUARTO ORDEN


1.- ANALISIS DEL METODO Habamos analizado este mtodo para nica ecuacin, ahora lo que se nos presenta es un sistema, el mtodo no vara en su fundamento, lo que para esta situacin se agrega, es un clculo paralelo de las ecuaciones, lo que significa que computacionalmente el nmero de operaciones crece proporcionalmente al orden del sistema. 2.- PSEUDOCODIGO
1. function [S]=seoRK4(f1,f2,a,b,ya1,ya2,n) 2. h=(b-a)/n; 3. t=a:h:b; 4. y1=zeros(1,n+1); 5. y2=zeros(1,n+1); 6. y1(1)=ya1; 7. y2(1)=ya2; 8. syms x 9. syms y 10. for j=1:n

k11=h*subs(f1,{x,y},{t(j),y1(j),y2(j)}); k12=h*subs(f2,{x,y},{t(j),y1(j),y2(j)}); k21=h*subs(f1,{x,y},{t(j)+h/2,y1(j)+k11*h/2,y2(j)+k12*h/2}); k22=h*subs(f2,{x,y},{t(j)+h/2,y1(j)+k11*h/2,y2(j)+k12*h/2}); k31=h*subs(f1,{x,y},{t(j)+h/2,y1(j)+k21*h/2,y2(j)+k22*h/2}); k32=h*subs(f2,{x,y},{t(j)+h/2,y1(j)+k21*h/2,y2(j)+k22*h/2}); k41=h*subs(f1,{x,y},{t(j)+h,y1(j)+k31*h,y2(j)+k32*h}); k42=h*subs(f2,{x,y},{t(j)+h,y1(j)+k31*h,y2(j)+k32*h}); y1(j+1)=y1(j)+(k11+2*k21+2*k31+k41)/6; y2(j+1)=y2(j)+(k12+2*k22+2*k32+k42)/6;
11. S=[t' y1' y2']; 12. plot(S(:,1),S(:,2)) 13. hold on 14. plot(S(:,1),S(:,3)) 15. hold off

4 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

3.- EJEMPLO DE CORRIDA

5 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

GRAFICA 1 plot(S(:,1),S(:,3))

GRAFICA 2 plot(S(:,1),S(:,2))

6 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

GRAFICA 3 plot(S(:,1),S(:,3)) VS plot(S(:,1),S(:,2))

7 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL 4.- CONCLUSIONES Sabiendo que la gran mayora de los fenmenos fsicos se presentan como un sistema de ecuaciones diferenciales, tras haber analizado el mtodo para una sola ecuacin y considerando su aplicacin, el costo computacional pasa a un segundo plano y damos prioridad a la utilidad de la aplicacin del mtodo en la resolucin no de una sino de un sistema de ecuaciones.

SIMULINK
Definicin

Simulink es una aplicacin que permite construir y simular modelos de sistemas fsicos y sistemas de control mediante diagramas de bloques. El comportamiento de dichos sistemas se define mediante funciones de transferencia, operaciones matemticas, elementos de Matlab y seales predefinidas de todo tipo. Simulink dispone de una serie de utilidades que facilitan la visualizacin, anlisis y guardado de los resultados de simulacin. Simulink se emplea profusamente en ingeniera de control. El entorno de trabajo de Simulink Simulink es una herramienta de gran utilidad para la simulacin de sistemas dinmicos. Principalmente, se trata de un entorno de trabajo grfico, en el que se especifican las partes de un sistema y su interconexin en forma de diagrama de bloques. De nuevo, se trata de una herramienta amplsima que adems se complementa con numerosos elementos opcionales. Adems de las capacidades de simulacin de las que est dotado Simulink, conviene destacar que contiene cmodas utilidades de visualizacin y almacenamiento de resultados de simulacin. Uso de Simulink En primer lugar, lanzaremos la aplicacin escribiendo simulink en la lnea de comandos de Matlab, o abriendo desde el Explorador de
8 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

Windows cualquier fichero con extensin .mdl. En el primero de los casos se abrir la ventana de la figura.

Esta ventana inicial no est destinada a crear modelos de simulacin; su funcin principal consiste en navegar por la enorme librera de bloques disponibles para el modelado. En ella distinguimos dos partes: la izquierda contiene una visin en forma de rbol de todos los Toolboxes instalados que contienen bloques Simulink. La amplitud de este rbol depender de las opciones que hayamos activado al seleccionar Matlab. De todos los nodos del rbol nos interesan, de momento, los denominados Simulink y Control System Toolbox. Cabe mencionar adems, por su inters, los bloques Real Time Workshop destinados a generar automticamente cdigo de control para determinadas plataformas Hardware comerciales. La parte derecha de la ventana de la figura muestra los bloques Simulink contenidos en el Toolbox o nodo de la parte izquierda de la ventana. Estos bloques se deben arrastrar sobre el espacio de trabajo de Simulink para la creacin de modelo a simular. Por ltimo, cabe indicar que en la parte superior de la ventana de inicio de Simulink hay varias herramientas como la bsqueda de un bloque determinado a partir de su nombre, que nos pueden resultar bastante tiles.

9 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

SISTEMA DE ECUACIONES ORDINARIAS MEDIANTE EL METODO DE RUNGE KUTTA DE CUARTO ORDEN EJERCICIO APLICADO CON SIMULINK DATOS

SOLUCION DE EJERCICIO

10 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

GRAFICAS

11 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

12 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

SOLUCION DE EJERCICIO CON IMPLEMENTACION DEL BLOQUE MUX

13 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

GRAFICA

14 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

SISTEMA DE ECUACIONES LINEALES


15 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

ESTRUCTURA HIPERESTATICA

1.- ANALISIS DEL METODO El mtodo de los desplazamientos, es algo ambiguo matemticamente, pero su implementacin se torna sencilla tras la aplicacin de ciertos criterios y artificios; considerando continuidad, Ley de Hooke y equilibrio, la dificultad presente es la matriz de continuidad, la que obtenemos a partir de las matrices de nudos y barras; las operaciones son simples y se emplean bucles para las operaciones elemento a elemento de las matrices utilizadas. 2.- PSEUDOCODIGO GRAFICA DE LA ESTRUCTURA function[h,j,ind]=grafestructura(cn,cb) ind=1 [nn,mn]=size(cn) [nb,mb]=size(cb) if (mn~=2)&&(mb~=2) ind=-1 6. end 7. h=[ ] 8. j=[ ] 9. for k=1:nb A=[cn(cb(k,1),1) cn(cb(k,2),1)] h=[h,A] B=[cn(cb(k,1),2) cn(cb(k,2),2)] j=[j,B] 10. end
1. 2. 3. 4. 5. 11. 12. plot(h,j) end

MATRIZ A
1. 2. 3. 4. 5.

function[a]=matriz_a(cn,cb) [nn,mn]=size(cn); [nb,mb]=size(cb); for l=1:nb; for k=1:2; ap1(cb(l,k),l)=1; 6. End 7. End 8. for j=2:nn-1 ap2(j-1,:)=ap1(j,:); 16 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL


9. end 10. ap2=ap2'; 11. cb=angulo(cb,cn); 12. for j=1:nb; 13. for l=1:nn-2;

if ap2(j,l)==1; k=l*2-1; a(j,k)=cos(cb(j,4)); a(j,k+1)=sin(cb(j,4));

ESTRUCTURA HIPERESTATICA
1. 2. 3. 4. 5. 6. 7.

14. end 15. end 16. end

function[E,D,P]=estructura_hiperestatica(cn,cb,f) a=matriz_a(cn,cb); k=diag(cb(:,3)); K = a'* k*a; D=(K^(-1))*f; E=a*D; P=k*E;

3.- EJEMPLO DE CORRIDA

17 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

18 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL 4.- CONCLUSIONES La estructura analizada, ciertamente no es de gran complejidad pero nos muestra el camino a seguir para la correcta resolucin de estructuras ms grandes, el empleo de operaciones simples nos proporcionan una eficiente resolucin, sujeta nicamente a los errores de truncamiento y redondeo propios de la mquina. La dependencia tanto al tipo de material de cada una de las barras de la armadura como al de las fuerzas externas presentes en cada nudo, muestran que todas las estructuras son diferentes, pero su resolucin es la misma, en este caso eficiente y satisfactoria.

GUI
19 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

El objetivo es realizar interfaces grficas de usuario, a las que nos referiremos como GUI-s que es como se normalmente se conocen. El lenguaje ms habitual para crear GUI-s es Java, ya que tiene la enorme ventaja de funcionar en cualquier mquina, sin embargo Java resulta muy lento para hacer clculos eficientemente, y es aqu donde MatLab es ms poderoso. Una vez que tenemos claro qu objetos tendr la GUI, grficos, textos, radio buttons, check boxes, edicin de texto, entrada de valores, lectura de matrices, etc, y una vez que tengamos claro de qu forma aparecern en la interfaz (el layout) es necesario hacer un programa de tipo script que tenga la misma funcionalidad que la GUI que queremos programar. Antes de incorporar el programa a la GUI, es necesario hacer todo tipo de pruebas con l hasta estar completamente seguros de que el programa que vamos a incorporar en la GUI es el programa que queremos. Para hacer las necesarias pruebas lo mejor es hacerlas sobre un script y no directamente sobre la GUI. APLICACIN DE GUI
1.- CODIFICACION
function varargout = armadurahiperestatik(varargin) % ARMADURAHIPERESTATIK M-file for armadurahiperestatik.fig % ARMADURAHIPERESTATIK, by itself, creates a new ARMADURAHIPERESTATIK or raises the existing % singleton*. % % H = ARMADURAHIPERESTATIK returns the handle to a new ARMADURAHIPERESTATIK or the handle to % the existing singleton*. % % ARMADURAHIPERESTATIK('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in ARMADURAHIPERESTATIK.M with the given input arguments. % % ARMADURAHIPERESTATIK('Property','Value',...) creates a new ARMADURAHIPERESTATIK or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before armadurahiperestatik_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to armadurahiperestatik_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". %

20 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL


% See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help armadurahiperestatik % Last Modified by GUIDE v2.5 10-Jan-2011 18:59:49 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @armadurahiperestatik_OpeningFcn, ... 'gui_OutputFcn', @armadurahiperestatik_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 armadurahiperestatik is made visible. function armadurahiperestatik_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 armadurahiperestatik (see VARARGIN) % Choose default command line output for armadurahiperestatik handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes armadurahiperestatik wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = armadurahiperestatik_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

21 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL


varargout{1} = handles.output; % --- Executes on button press in numnod. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to numnod (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in numbar. function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to numbar (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in pushbutton3. function pushbutton3_Callback(hObject, eventdata, handles) % hObject handle to pushbutton3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

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)

22 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL


% 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

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

23 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

% --- 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 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)

24 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL


% eventdata % handles called reserved - to be defined in a future version of MATLAB empty - handles not created until after all CreateFcns

% 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 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

25 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL


% 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 cn_Callback(hObject, eventdata, handles) % hObject handle to cn (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 cn as text % str2double(get(hObject,'String')) returns contents of cn as a double Val=get(hObject,'String'); %Almacenar valor ingresado cn = str2double(Val);%Transformar a formato double handles.cn=cn;%Almacenar en identificador guidata(hObject,handles);%Salvar datos de la aplicacin

% --- Executes during object creation, after setting all properties. function cn_CreateFcn(hObject, eventdata, handles) % hObject handle to cn (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 cb_Callback(hObject, eventdata, handles) % hObject handle to cb (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 cb as text % str2double(get(hObject,'String')) returns contents of cb as a double Val=get(hObject,'String'); %Almacenar valor ingresado cb = str2double(Val);%Transformar a formato double handles.cb=cb;%Almacenar en identificador guidata(hObject,handles);%Salvar datos de la aplicacin

26 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

% --- Executes during object creation, after setting all properties. function cb_CreateFcn(hObject, eventdata, handles) % hObject handle to cb (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 F_Callback(hObject, eventdata, handles) % hObject handle to F (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 F as text % str2double(get(hObject,'String')) returns contents of F as a double Val=get(hObject,'String'); %Almacenar valor ingresado F = str2double(Val);%Transformar a formato double handles.F=F;%Almacenar en identificador guidata(hObject,handles);%Salvar datos de la aplicacin % --- Executes during object creation, after setting all properties. function F_CreateFcn(hObject, eventdata, handles) % hObject handle to F (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 pushbutton4. function pushbutton4_Callback(hObject, eventdata, handles) % hObject handle to pushbutton4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [nn,mn]=size(handles.cn); cn=handles.cn [nb,mb]=size(handles.cb); cb=handles.cb for l=1:nb;

27 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL


for k=1:2; ap1(cb(l,k),l)=1; end end for j=2:nn-1 ap2(j-1,:)=ap1(j,:); end ap2=ap2'; handles.cb=angulo(cb,cn); for j=1:nb; for l=1:nn-2; if ap2(j,l)==1; k=l*2-1; a(j,k)=cos(cb(j,4)); a(j,k+1)=sin(cb(j,4)); end end end %a=matriz_a(handles.cn,handles.cb); k=diag(handles.cb(:,3)); K = a'* k*a; D=(K^(-1))*(handles.F); E=a*D; P=k*E; % --- Executes on button press in pushbutton6. function pushbutton6_Callback(hObject, eventdata, handles) % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on mouse press over axes background. function grafica_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to grafica (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) cn=(handles.cn); cb=(handles.cb); h=[ ]; j=[ ]; for k=1:nb; A=[cn(cb(k,1),1) cn(cb(k,2),1)]; h=[h,A]; B=[cn(cb(k,1),2) cn(cb(k,2),2)]; j=[j,B]; end plot(h,j)

2. - FIGURA EN GUI

28 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

AUTOVECTORES Y AUTOVALORES

SISTEMA DINAMICO
1.- ANALISIS DEL METODO Considerando a n como el nmero de elementos del sistema dinmico, las operaciones realizadas en la resolucin de dicho sistema es de 4n-17, que incluye la determinacin de auto valores mediante un mtodo que en su momento tambin fue analizado, las operaciones algebraicas realizadas 29 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL previamente requieren cierto cuidado, pero al ser completadas adecuadamente, nos proporciona una sencilla implementacin, la cual no obstante implica un conocimiento ms o menos amplio de autovalores y autovectores.

2.- PSEUDOCODIGO
1. function[x,v]=SistemaDinamico(k,m,n,z,s,to) 2. for j=1:n-1 3. A(j,j)=(k(j)+k(j+1))/m(j); 4. A(j,j+1)=(k(j+1))/m(j); 5. A(j+1,j)=(k(j+1))/m(j); 6. A(n,n)=k(n)/m(n); 7. syms z 8. I=eye(n); 9. P=A-z*I; 10. Q=det(P); 11. w1=sqrt(roots(sym2poly(Q))); 12. w2=w1.^2; 13. for j=1:size(w2) 14. H(:,:,j)=A-w2(j)*I; 15. End 16. for t=1:n 17. H(:,:,t)=rref(H(:,:,t)); 18. for j=n-1:-1:1 19. r(1,1)=-H(j,n,t)*s/H(j,j,t); 20. r(2,1)=-H(j,n,t)*s/H(j,j,t); 21. r(j,t)=-H(j,n,t)*s/H(j,j,t); 22. End 23. r(n,t)=s; 24. End 25. tt=to:n 26. x=r*sin(w1*tt) 27. figure(1) 28. subplot(1,2,1) 29. plot(tt,x(:,1),'b') 30. hold on; 31. plot(tt,x(:,2),'r') 32. plot(tt,x(:,3),'g') 33. ylabel('espacios') 34. xlabel('tiempo') 35. title('Sistema dinmico- resortes') 36. hold off; 37. w3=diag(w1) 38. v=w3*r*cos(w1*tt) 39. subplot(1,2,2) 40. plot(tt,v(:,1),'b') 41. hold on; 42. plot(tt,v(:,2),'r')

30 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL


43. 44. 45. 46. 47.

plot(tt,v(:,3),'g') ylabel('velocidades') xlabel('tiempo') title('Sistema dinmico- resortes') hold off;

3.- EJEMPLO DE CORRIDA

31 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

32 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

METODOS NUMERICOS APLICADOS QUINTO SEMESTRE 1- INGENIERIA CIVIL

4.- CONCLUSIONES Tomando en cuenta que en el sistema la nica fuerza que acta es la fuerza de gravedad, la aplicacin de la ley de Hooke se torna muy importante al realizar las operaciones algebraicas que se emplean en la implementacin del mtodo, considerando de esta forma que a pesar del elevado nmero de operaciones que emplea el mtodo, sus resultados satisfacen nuestros requerimientos al momento de resolver sistemas dinmicos que no necesariamente involucren resortes. Es decir el mtodo de autovalores y autovectores conjuntamente con las leyes equilibrio y la Ley de Hooke, se consideran una gran herramienta en aplicaciones prcticas de Sistemas Dinmicos.

33 VALERIA RAMOS BERMEO DAVID PINOS PLASENCIA

También podría gustarte