Matlab - Puedo tener dos gráficas en un mismo axis

 
Vista:

Puedo tener dos gráficas en un mismo axis

Publicado por Simona (15 intervenciones) el 03/08/2013 20:39:14
Hola, es que pretendo tener dos gráficas de caída libre y después de un objeto en el fluido , pero no sé como hacer para tener las dos gráficas en un mismo axis

así esta bien?
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)

global r ;
r=str2double(get(handles.radio,'String'));
global de ;
global vis;

yo=15;
vyo=0;
g=-9.8;

tcaidali=(yo*2/g)^(1/2);


t=0:1/50:5:(((6)^2/7)+20);

%tMax = 0;
%deltaT = 0.50;
%t = tcaidali;



%%Ecuaciones caida libre
x=0*t;
vy = vyo + g*t;
y=yo+vyo*t+(1/2)*g*t.^2;

%%%Material--->Cobre
densidadcobre=8500;
%Entra en el fluido a una altura de cinco metros
if yo==5
%%Ecuaciones Fluidos

m=(densidadcobre*(4/3)*pi*(r.^2));
b=(6*pi*r*vis);
E=(de*(4/3)*pi*(r.^3)*g);

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



for i=1:length(t) % para animar las grafica
pause(1/50) % tiempo para que se detenga tiempo igual al de arriba


%subplot(2,2,1)% Matriz 2x2 posición1
plot(handles.axes1,t(i),vy(i))
xlabel(handles.axes1,'tiempo t(s)')
ylabel(handles.axes1,'Velocidad en Y - Vy (m/s)')
axis(handles.axes1,[min(t) max(t) min(vy) max(vy)])
hold (handles.axes1,'on')
yo=yo+1;
plot(handles.axes2,x(i),y(i), 'o r')
xlabel(handles.axes2,'Posición x(m)')
ylabel(handles.axes2,'Posición y(m)')
axis(handles.axes1,axis,[-2 2 min(y) max(y)])
hold (handles.axes2,'on')

plot(handles.axes1,t(i),v(i))
xlabel(handles.axes1,'tiempo t(s)')
ylabel(handles.axes1,'Velocidad en Vl - Vl (m/s)')
axis(handles.axes1,axis,[min(t) max(t) min(v) max(v)])
hold (handles.axes1,'on')


end
end
%tMax = 3;
%deltaT = 0.01;
%t = 0;

%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(handles.axes2,'tiempo en t(s).')
% ylabel(handles.axes2,'Velocidad en Vy(m/s)')
% axis([0 tMax -5 5])
% hold (handles.axes2,'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
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
Imágen de perfil de JOSE JEREMIAS CABALLERO
Val: 6.975
Oro
Ha mantenido su posición en Matlab (en relación al último mes)
Gráfica de Matlab

Puedo tener dos gráficas en un mismo axis

Publicado por JOSE JEREMIAS CABALLERO (5917 intervenciones) el 05/08/2013 23:26:58
plot(X1,Y1,...,Xn,Yn) plots each vector Yn versus vector Xn on the same axes. If one of Yn or Xn is a matrix and the other is a vector, it plots the vector versus the matrix row or column with a matching dimension to the vector. If Xn is a scalar and Yn is a vector, it plots discrete Yn points vertically at Xn. If Xn or Yn are complex, imaginary components are ignored. If Xn or Yn are matrices, they must be 2-D and the same size, and the columns of Yn are plotted against the columns of Xn. plot automatically chooses colors and line styles in the order specified by ColorOrder and LineStyleOrder properties of current axes.


Saludos.
JOSE JEREMÍAS CABALLERO
Asesorías en Matlab
programador en matlab
Servicios de programación matlab
[email protected]


http://matlabcaballero.blogspot.com


http://www.lawebdelprogramador.com/foros/Matlab/1371532-FORMA_DE_APRENDER_MATLAB.html
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar