Matlab - Graficando en Matlab

   
Vista:

Graficando en Matlab

Publicado por 0221Dannie (15 intervenciones) el 30/07/2013 07:25:16
Hola!
Estoy super enredada con un código en matlab, es de mecánica de fluidos
una bola debe caer en caida libre en 3 fluidos diferentes y se simulara su reacción , mi duda es
como hago la parte gráfica, es decir , es posible hacer que matlab la animación de esta caída ; con los fluidos? si es así
¿Cómo lo puedo hacer?

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

% Last Modified by GUIDE v2.5 25-Jul-2013 22:54:39

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

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

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = Fluido_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 selection change in fluido.
function fluido_Callback(hObject, eventdata, handles)
% hObject handle to fluido (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns fluido contents as cell array
% contents{get(hObject,'Value')} returns selected item from fluido


val = get(hObject, 'Value');
switch val
case 1
% El usuario seleccionó la primera opción AGUA
de=1000;
vis=0.001;
case 2
% El usuario seleccionó la segunda opción ACEITE
de=920;
vis=0.03;
case 3
% El usuario seleccionó la 3 opción GLICERINA
de=1200;
vis=1.5;
end
% --- Executes during object creation, after setting all properties.
function fluido_CreateFcn(hObject, eventdata, handles)
% hObject handle to fluido (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 radio_Callback(hObject, eventdata, handles)
% hObject handle to radio (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 radio as text
% str2double(get(hObject,'String')) returns contents of radio as a double


% --- Executes during object creation, after setting all properties.
function radio_CreateFcn(hObject, eventdata, handles)
% hObject handle to radio (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB

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

r=str2double(get(handles.radio,'String'))

tMax = 3;
deltaT = 0.01;
t = 0;
g=-9.8;
%Bola caida libre
while tiempoTranscurrido < tMax
%caídalibre
x =0*deltaT;
y = yo+Vyo*deltaT+(1/2)*g*deltaT.^2;

vy = vy + g*deltaT;

plot(handles.axes2, t, vy);
xlabel('tiempo en t(s).')
ylabel('Velocidad en Vy(m/s)')
axis([0 tMax -5 5])
hold on

end

v=v2*(1-exp((-b/m)*t);
x=vt*(t-(m/b)*(1-exp((-b/m)*t));
vl=(2*r^2*g*(de-df))*9*vis;

b=(6*Pi*r*vis);
E=(df*(4/3)*Pi*(r^3)*g);
m=(de*(4/3)*Pi*(r^2));

%plotear v vs tiempo



%

agradezo la ayuda :)
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder