En axes d un GUI el LEGEND son del mismo color??
Publicado por Luis Miguel (15 intervenciones) el 06/11/2009 18:29:03
Buenas,
Tengo un pequeño problema que es el siguiente, cuando ejecuto una grafica quiero q me aparezca la legenda para cada uno de los graficos q tengo dentro de mi ventana axes y me aparece pero las rayas que indican a que grafico pertenece son del mismo color y no se puede cambiar por mas q lo intento, este es mi codigo
function pushbutton1_Callback(hObject, eventdata, handles)
% DATOS
m=str2double(get(handles.edit1,'String'));
c=str2double(get(handles.edit2,'String'));
k=str2double(get(handles.edit3,'String'));
X0=str2double(get(handles.edit4,'String'));
V0=str2double(get(handles.edit5,'String'));
a=str2double(get(handles.edit6,'String'));
Wn=sqrt((k/m));
factor_amortiguamiento=(c/(2*Wn*m));
T=(2*pi/Wn);
Wd=Wn*sqrt(1- factor_amortiguamiento^2);
phi=atan((-(V0/(X0*Wd-(a*Wd/Wn^2)))-(real/Wd)));
C=(X0/cos(phi)-(a/(Wn^2*cos(phi))));
Td=(2*pi/Wd);
t=[0:pi/360:Td*1.2];
%----------------------------------------------------------------------
%Respuesta del sistema
X= ((C.*cos(Wd*t - phi))).*exp(-real*t)+ a/Wn^2; % SISTEMA SUBAMORTIGUADO
%---------------------------------------------------------------------
%GRAFICAR
axes(handles.axes2)
handles.ejex=t;
min_X3=min(X);
max_X3=max(X);
plot(handles.ejex,a,'r','LineWidth',2.5);
hold on
plot(handles.ejex,X,'b','LineWidth',2.5);
legend('Escalon','Respuesta');
xlabel('W*t'),ylabel('X= (C*cos(Wd*t + phi))*exp(-real*t)+a/Wn^2');
grid on;
axis([0 Td*1.2 min_X3*1.2 max_X3*1.2]);
hold off;
%---------------------------------------------------------------------------------------
ME APARECEN LOS DOS COMENTARIOS DE LEGEND DE COLOR ROJO DEL PRIMER COLOR Q TENGA PUESTO EN EL PRIMER PLOT Y NO SE COMO CAMBIARLO.
Gracias a todos!!
SALUDOS!!
Tengo un pequeño problema que es el siguiente, cuando ejecuto una grafica quiero q me aparezca la legenda para cada uno de los graficos q tengo dentro de mi ventana axes y me aparece pero las rayas que indican a que grafico pertenece son del mismo color y no se puede cambiar por mas q lo intento, este es mi codigo
function pushbutton1_Callback(hObject, eventdata, handles)
% DATOS
m=str2double(get(handles.edit1,'String'));
c=str2double(get(handles.edit2,'String'));
k=str2double(get(handles.edit3,'String'));
X0=str2double(get(handles.edit4,'String'));
V0=str2double(get(handles.edit5,'String'));
a=str2double(get(handles.edit6,'String'));
Wn=sqrt((k/m));
factor_amortiguamiento=(c/(2*Wn*m));
T=(2*pi/Wn);
Wd=Wn*sqrt(1- factor_amortiguamiento^2);
phi=atan((-(V0/(X0*Wd-(a*Wd/Wn^2)))-(real/Wd)));
C=(X0/cos(phi)-(a/(Wn^2*cos(phi))));
Td=(2*pi/Wd);
t=[0:pi/360:Td*1.2];
%----------------------------------------------------------------------
%Respuesta del sistema
X= ((C.*cos(Wd*t - phi))).*exp(-real*t)+ a/Wn^2; % SISTEMA SUBAMORTIGUADO
%---------------------------------------------------------------------
%GRAFICAR
axes(handles.axes2)
handles.ejex=t;
min_X3=min(X);
max_X3=max(X);
plot(handles.ejex,a,'r','LineWidth',2.5);
hold on
plot(handles.ejex,X,'b','LineWidth',2.5);
legend('Escalon','Respuesta');
xlabel('W*t'),ylabel('X= (C*cos(Wd*t + phi))*exp(-real*t)+a/Wn^2');
grid on;
axis([0 Td*1.2 min_X3*1.2 max_X3*1.2]);
hold off;
%---------------------------------------------------------------------------------------
ME APARECEN LOS DOS COMENTARIOS DE LEGEND DE COLOR ROJO DEL PRIMER COLOR Q TENGA PUESTO EN EL PRIMER PLOT Y NO SE COMO CAMBIARLO.
Gracias a todos!!
SALUDOS!!
Valora esta pregunta


0