Good Day everyone Ma'am and sir. i'm really sorry for your time. i just practiced the code that have shared in this group but application in 6 storey building. im really worried because it dont appread the plot on on the axis.

2 次查看(过去 30 天)
function THAsel_Callback(hObject, eventdata, handles)
THAsel=get(handles.THAsel,'Value');
clc
switch THAsel
case 1 %First floor
modesel=1;
case 2 %Second floor
modesel=2;
case 3 %Third floor
modesel=3;
case 4 %Forth floor
modesel=4;
case 5 %Fifth floor
modesel=5;
case 6 % Sixth floor
modesel=6;
case 7 %whole building displacements
modesel=7;
case 8 %whole building velocity
modesel=8;
case 9 %whole building acceleration
modesel=9;
end
cla
THR= getappdata(handles.mode , 'THR');
M= getappdata(handles.result, 'M');
Vnorm= getappdata(handles.result , 'Vnorm');
t= getappdata(handles.result , 't');
ag=getappdata(handles.openfile,'y');
DISPL= getappdata(handles.result , 'DISPL');
VEL= getappdata(handles.result , 'VEL');
AC= getappdata(handles.result , 'AC');
cla reset
axis auto
if THR==1
if modesel==7 %BUILDING DISPLACEMENTS
plot(t,DISPL(6,:),'-m',t,DISPL(5,:),'-y',t,DISPL(4,:),'-k',t,DISPL(3,:),'-r',t,DISPL(2,:),'-g',t,DISPL(1,:),'-b');
title(sprintf('Building Displacements'));
legend ('First floor','Second floor', 'Third floor','Fourth Floor','Fifth Floor', 'Sixth Floor','Location', 'best');
ylabel ('Horizontal Displacement (m)');
elseif modesel==8 %BUILDING VELOCITY
plot(t,VEL(6,:),'-m',t,VEL(5,:),'-y',t,VEL(4,:),'-k',t,VEL(3,:),'-r',t,VEL(2,:),'-g',t,VEL(1,:),'-b');
title(sprintf('Building Velocity'));
legend ('First floor','Second floor', 'Third floor','Fourth Floor','Fifth Floor', 'Sixth Floor','Location', 'best');
ylabel ('Velocity (m/s)');
elseif modesel==9 %BUILDING ACCELERATION
plot(t,AC(6,:),'-m',t,AC(5,:),'-y',t,AC(4,:),'-k',t,AC(3,:),'-r',t,AC(2,:),'-g',t,AC(1,:),'-b');
title(sprintf('Building Acceleration'));
legend ('First floor','Second floor', 'Third floor','Fourth Floor','Fifth Floor', 'Sixth Floor','Location', 'best');
ylabel ('Acceleration (m/s^{2})');
elseif modesel==1 % FIRST FLOOR TH
plot(t,DISPL(6,:),'-g',t,VEL(6,:),'-m',t,AC(6,:),'-k');
title(sprintf('First floor'));
legend ('Horizontal Displacement','Velocity', 'Acceleration', 'Location', 'best');
ylabel ('Displ (m), Vel. (m/s), Accel. (m/s^{2}) ');
elseif modesel==2 % SECOND FLOOR TH
plot(t,DISPL(5,:),'-g',t,VEL(5,:),'-m',t,AC(5,:),'-k');
title(sprintf('Second floor'));
legend ('Horizontal Displacement','Velocity', 'Acceleration', 'Location', 'best');
ylabel ('Displ (m), Vel. (m/s), Accel. (m/s^{2}) ');
elseif modesel==3 % THIRD FLOOR TH
plot(t,DISPL(4,:),'-g',t,VEL(4,:),'-m',t,AC(4,:),'-k');
title(sprintf('Third floor'));
legend ('Horizontal Displacement','Velocity', 'Acceleration', 'Location', 'best');
ylabel ('Displ (m), Vel. (m/s), Accel. (m/s^{2}) ');
elseif modesel==4 % FOURTH FLOOR TH
plot(t,DISPL(3,:),'-g',t,VEL(3,:),'-m',t,AC(3,:),'-k');
title(sprintf('Fourth floor'));
legend ('Horizontal Displacement','Velocity', 'Acceleration', 'Location', 'best');
ylabel ('Displ (m), Vel. (m/s), Accel. (m/s^{2}) ');
elseif modesel==5 % FIFTH FLOOR TH
plot(t,DISPL(2,:),'-g',t,VEL(2,:),'-m',t,AC(2,:),'-k');
title(sprintf('Fifth floor'));
legend ('Horizontal Displacement','Velocity', 'Acceleration', 'Location', 'best');
ylabel ('Displ (m), Vel. (m/s), Accel. (m/s^{2}) ');
else % 6th FLOOR TH
plot(t,DISPL(1,:),'-g',t,VEL(1,:),'-m',t,AC(1,:),'-k');
title(sprintf('Sixth floor'));
legend ('Horizontal Displacement','Velocity', 'Acceleration', 'Location', 'best');
ylabel ('Displ (m), Vel. (m/s), Accel. (m/s^{2}) ');
end
end
grid on
xlabel('Time (sec)');
guidata(hObject, handles);

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by