📄 program1.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Program1.m %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global textA axesA_text textB axesB_text input_coords pos_on pos_off fig
% 1. Building Information
global Nfloors H_bldg Fdofs Ndofs RNmodes AnL_A AnL_B anal
global T T_str D D_str flnMode_shape evectors omega h
%% 2. Wind Tunnel Information
global Ntaps flnTaps flnCp Vm freq ms Npoints
% 3. Program Inputs
global flnMem flDif flnProps mem_list props WS WS_str WD WD_str
global MRI MRI_str mri IMdir_A IMdir_B intmeth mem_out
% 4. Loads and Reactions
global flnMass DL SDL LL
global flnDLr flnSDLr flnLLr frames_DL frames_SDL frames_LL
global DLf SDLf LLf WLf
% 5. Wind Effect Selection
global WLE Hmp Hfile Vth rf tstep Npointsout
global Qs flHfile
% 6. Calculations
global saveBij flnSaveBij flnSavemaxBij flnSaveMRI
% 7. Output
global AnL_A AnL_B IMdir_A IMdir_B Hmp Vth DLf SDLf LLf WLf
global mem_out mem_list
% 8. Save/Load Data
global fnSAVE flSAVE flnSAVE fnLOAD flLOAD flnLOAD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc
%%%%%%%%%%%%%%%%%%%%%%%% Member list : mem_list, Page 3, [1 x any] %%%%%%%%%%%%%%%%%%%%%%%%%%%
% Load 'flnMem' and check for errors
clear fid; fid=fopen(flnMem);
if fid == -1
errordlg('Unable to open ''flnMem'' - Page 3')
error ('Unable to open ''flnMem'' - Page 3')
end
fclose(fid); clear fid;
mem_list=[]; load (flnMem)
if isempty(mem_list)==1
errordlg('Variable ''mem_list'' not defined. See flnMem on Page 3')
error ('Variable ''mem_list'' not defined. See flnMem on Page 3')
end
if min(size(mem_list,1)) ~= 1
errordlg('Variable ''mem_list'' should be a vector')
error ('Variable ''mem_list'' should be a vector')
end
%%%%%%%%%%%%%%%%%% Member properties : props, Page 3, [length(mem_list) x 5] %%%%%%%%%%%%%%%%%
% Load 'flnProps' and check for errors
clear fid; fid=fopen(flnProps);
if fid == -1
errordlg('Unable to open ''flnProps'' - Page 3')
error ('Unable to open ''flnProps'' - Page 3')
end
fclose(fid); clear fid;
props=[]; load(flnProps)
if isempty(props)==1
errordlg('Variable ''props'' not defined. See flnProps on Page 3')
error ('Variable ''props'' not defined. See flnProps on Page 3')
end
if size(props,1) ~= length(mem_list) | size(props,2) ~= 5
errordlg('Variable ''props'' not properly sized (length(mem_list) x 5)')
error ('Variable ''props'' not properly sized (length(mem_list) x 5)')
end
% Assign internal variables to values in 'props'
all_mems = props(:,1);
Pnt = props(:,2);
Pnc = props(:,3);
Mn2 = props(:,4);
Mn3 = props(:,5);
%%%%%%%%%%%% Static load reactions - DL : frames_DL, Page 4, [length(mem_list) x 4] %%%%%%%%%%
% Load 'flnDLr' and check for errors
clear fid; fid=fopen(flnDLr);
if fid == -1
errordlg('Unable to open ''flnDLr'' - Page 4')
error ('Unable to open ''flnDLr'' - Page 4')
end
fclose(fid); clear fid;
frames_DL=[]; load (flnDLr)
if isempty(frames_DL)==1
errordlg('Variable ''frames_DL'' not defined. See flnDLr on Page 4')
error ('Variable ''frames_DL'' not defined. See flnDLr on Page 4')
end
if size(frames_DL,1) ~= length(mem_list) | size(frames_DL,2) ~= 4
errordlg('Variable ''frames_DL'' not properly sized (length(mem_list) x 4)')
error ('Variable ''frames_DL'' not properly sized (length(mem_list) x 4)')
end
% Assign internal variables to values of 'frames_DL'
% (units: N/N*m or kN/kN*m; choice should be consistent with the units used in function 'F_Ft.m')
P_DL = frames_DL(:,2);
M2_DL = frames_DL(:,3);
M3_DL = frames_DL(:,4);
%%%%%%%%%%% Static load reactions - SDL : frames_SDL, Page 4, [length(mem_list) x 4] %%%%%%%%%
% Load 'flnSDLr' and check for errors
clear fid; fid=fopen(flnSDLr);
if fid == -1
errordlg('Unable to open ''flnSDLr'' - Page 4')
error ('Unable to open ''flnSDLr'' - Page 4')
end
fclose(fid); clear fid;
frames_SDL=[]; load (flnSDLr)
if isempty(frames_SDL)==1
errordlg('Variable ''frames_SDL'' not defined. See flnSDLr on Page 4')
error ('Variable ''frames_SDL'' not defined. See flnSDLr on Page 4')
end
if size(frames_SDL,1) ~= length(mem_list) | size(frames_SDL,2) ~= 4
errordlg('Variable ''frames_SDL'' not properly sized (length(mem_list) x 4)')
error ('Variable ''frames_SDL'' not properly sized (length(mem_list) x 4')
end
% Assign internal variables to values of 'frames_SDL'
% (units: N/N*m or kN/kN*m; choice should be consistent with the units used in function 'F_Ft.m')
P_SDL = frames_SDL(:,2);
M2_SDL = frames_SDL(:,3);
M3_SDL = frames_SDL(:,4);
%%%%%%%%%%%% Static load reactions - LL : frames_LL, Page 4, [length(mem_list) x 4] %%%%%%%%%%
% Load 'flnLLr' and check for errors
clear fid; fid=fopen(flnLLr);
if fid == -1
errordlg('Unable to open ''flnLLr'' - Page 4')
error ('Unable to open ''flnLLr'' - Page 4')
end
fclose(fid); clear fid;
frames_LL=[]; load (flnLLr)
if isempty(frames_LL)==1
errordlg('Variable ''frames_LL'' not defined. See flnLLr on Page 4')
error ('Variable ''frames_LL'' not defined. See flnLLr on Page 4')
end
if size(frames_LL,1) ~= length(mem_list) | size(frames_LL,2) ~= 4
errordlg('Variable ''frames_LL'' not properly sized (length(mem_list) x 4)')
error ('Variable ''frames_LL'' not properly sized (length(mem_list) x 4)')
end
% Assign internal variables to values of 'frames_LL'
% (units: N/N*m or kN/kN*m; choice should be consistent with the units used in function 'F_Ft.m')
P_LL = frames_LL(:,2);
M2_LL = frames_LL(:,3);
M3_LL = frames_LL(:,4);
%%%%%%%%%%%% Load factors for dynamic model : DLf, SDLf, LLf, WLf, Page 4, [1 x 1] %%%%%%%%%%%
% Reassign load factor variables to internal variables
DL_fact = DLf;
SDL_fact = SDLf;
LL_fact = LLf;
WL_fact = WLf;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Run a loop to calculate variables M and Fai on if inertial loads are to be included
if AnL_A == 1
%%%%%%%%%%%%%%%%%%%%%%%%%% Mass matrix : mass, Page 4, [1 x Ndofs] %%%%%%%%%%%%%%%%%%%%%%%%%
% Load 'flnMass' and check for errors
clear fid; fid=fopen(flnMass);
if fid == -1
errordlg('Unable to open ''flnMass'' - Page 4')
error ('Unable to open ''flnMass'' - Page 4')
end
fclose(fid); clear fid;
mass=[]; load (flnMass);
% Variable mass is a vector [m_x1, m_y1, m_rz1, m_x2, m_y2, m_rz2 ... ] of length Ndofs
if isempty(mass)==1
errordlg('Variable ''mass'' not defined. See flnMass on Page 4')
error ('Variable ''mass'' not defined. See flnMass on Page 4')
end
if length(mass) ~= Ndofs
errordlg('Variable ''mass'' not properly sized (vector with length =Ndofs)')
error ('Variable ''mass'' not properly sized (vector with length =Ndofs)')
end
if min(mass)<1
errordlg('All ''mass'' entries must be positive)')
error ('All ''mass'' entries must be positive')
end
% Convert the saved mass vector to a mass matrix
mx = mass(1:Fdofs:Fdofs*Nfloors)';
my = mass(2:Fdofs:Fdofs*Nfloors)';
mrz = mass(3:Fdofs:Fdofs*Nfloors)';
m = cat(2, mx, my, mrz);
M = diag(m);
% THE MASS MATRIX: diag[m_1x, m_2x, m_3x ... m_1y, m_2y, m_3y ... m_1rz, m_2rz, m_3rz ...],
% where in m_ij i = floor # and j = d.o.f.
%%%%%%%%%%%%%%%%%%% Modal matrix : evectors, Page 1, [Ndofs x RNmodes] %%%%%%%%%%%%%%%%%%%%%%%
% Load 'flnMode_shape' and check for errors
clear fid; fid=fopen(flnMode_shape);
if fid == -1
errordlg('Unable to open ''flnMode_shape'' - Page 1')
error ('Unable to open ''flnMode_shape'' - Page 1')
end
fclose(fid); clear fid;
evectors=[]; load (flnMode_shape)
if isempty(evectors) == 1
errordlg('Variable ''evectors'' not defined. See flnMode_shape on Page 1')
error ('Variable ''evectors'' not defined. See flnMode_shape on Page 1')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -