⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plotdif.m

📁 低矮房屋风压系数、风荷载计算分析matlab程序
💻 M
📖 第 1 页 / 共 3 页
字号:
function fig = plotDIF( DIF_struct )

% this function plots results stored in the input data structure 'DIF_struct'

% determine the following:
% - are the results from interpolation?
% - if not from interpolation, are all results available for DIF and load

length_units = DIF_struct.length_units;
ws_units = DIF_struct.ws_units;
terrain = DIF_struct.terrain;

d0 = DIF_struct.d0;

d = DIF_struct.d;
n_m = size(d,1);
if n_m>1
    interp=1;
end
d0_label{1} = [];
bnd_label = cell(1,n_m);
interp_label{1} = [];
d_label = cell(1,n_m);
d_round = round(10*d)/10;
d0_round = round(10*d0)/10;
d_symbol = 'WLHR';
for i = 1:4
    if isempty(d0_label{1})
        d0_label{1} = [d_symbol(i) '=' num2str(d0_round(i)) ' ' length_units ];
    else
        d0_label{1} = [d0_label{1} ', ' d_symbol(i) '=' num2str(d0_round(i)) ' ' length_units ];
    end
    if any(abs(d_round(:,i)-d0_round(i))>10^-3)
        if isempty(interp_label{1})
            interp_label{1} = [': ' d_symbol(i) ' = ['];
        else
            interp_label{1} = [interp_label{1} ', ' d_symbol(i) ' = ['];
        end
        for j=1:n_m
            d_label{j}
            if isempty(bnd_label{j})
                bnd_label{j} = [': ' d_symbol(i) ' = ' num2str(d_round(j,i)) ' ' length_units];
            else
                bnd_label{j} = [bnd_label{j} ', ' d_symbol(i) ' = ' num2str(d_round(j,i)) ' ' length_units];
            end
            if interp_label{1}(end)=='[' %]
                interp_label{1} = [interp_label{1} num2str(d_round(j,i)) ' ' length_units];
            else
                interp_label{1} = [interp_label{1} ', ' num2str(d_round(j,i)) ' ' length_units];
            end
        end
        interp_label{1} = [interp_label{1} ']' ];
    end
end
loadinterp_label{1} = ['Interpolated' interp_label{1}];
for i = 1:n_m
    loadinterp_label{i+1} = ['Model ' num2str(i) bnd_label{i}];
    for j = 1:4
        if isempty(d_label{i})
            d_label{i} = [d_symbol(j) '=' num2str(d_round(i,j)) ' ' length_units ];
        else
            d_label{i} = [d_label{i} ', ' d_symbol(j) '=' num2str(d_round(i,j)) ' ' length_units ];
        end
    end
end


frame_loc = DIF_struct.frame_coords(:,2);
n_f = length(frame_loc);
for i = 1:n_f
    frame_label{i} = ['Frame ' num2str(i) ': y = ' num2str(frame_loc(i)) ' ' length_units];
end

resp_names = DIF_struct.resp_names;
resp_units = DIF_struct.resp_units;
n_r = length(resp_names);
for i = 1:n_r
    resp_label{i} = ['Response ' num2str(i) ': ' resp_names{i} ' (' resp_units{i} ')'];
end

theta = DIF_struct.theta;
n_q = length(theta);
for i=1:n_q
    theta_label{i} = [num2str(theta(i)) ' degrees'];
end

% initialize plot selections:
f = 1; % frame number
r = 1; % response number
q = 1; % wind direction number




%attach_loc = DIF_struct.

scrsz = get(0,'ScreenSize');
X0 = scrsz(3)*.05;
Y0 = scrsz(4)*.1;
dX = scrsz(3)*.9;
dY = scrsz(4)*.8;

clr = get(0,'DefaultUicontrolBackgroundColor');

fig = figure('Color',clr,'Position',[X0 Y0 dX dY],'Name','DIF Results Plotting');

set( fig, 'Units', 'character');

Size = get( fig, 'Position');


X0 = Size(3);
Y0 = Size(4);

mw = 70; % menu width

Y_load = 0.5*Y0;
Y_DIF = 0.5*Y0;

load_panel = uipanel('Parent',fig,'BackgroundColor',clr,'Units','character','Position',[0 0 X0-mw Y_load],...
    'FontSize',12,'FontWeight','bold','TitlePosition','centertop','Title','Load Distribution');
if isfield( DIF_struct,'load_max' ) && ~isempty(DIF_struct.load_max)
    attach_pts = DIF_struct.attach_pts;
    load_axes = axes('Parent',load_panel);
end

DIF_panel = uipanel('Parent',fig,'BackgroundColor',clr,'Units','character','Position',[0 Y_load X0-mw Y_DIF],...
    'FontSize',12,'FontWeight','bold','TitlePosition','centertop','Title','Directional Influence Factors (DIFs)');
DIF_axes = axes('Parent',DIF_panel);


Y_sum = 8+1.5*n_m;
Y_menu = Y0-Y_sum;


sum_panel = uipanel('Parent',fig,'BackgroundColor',clr,'Units','character','Position',[X0-mw Y_menu mw Y_sum-.05],...
    'FontSize',12,'FontWeight','bold','TitlePosition','centertop','Title','Results Summary');
uicontrol('Parent',sum_panel,'Style','text','Units','character','HorizontalAlignment','left',...
    'Position', [2 Y_sum-3.5 mw-4 1.5],'String','Building Dimensions:');
uicontrol('Parent',sum_panel,'Style','text','Units','character','HorizontalAlignment','left',...
    'Position', [4 Y_sum-5 mw-4 1.5],'String',d0_label{1});
uicontrol('Parent',sum_panel,'Style','text','Units','character','HorizontalAlignment','left',...
    'Position', [2 Y_sum-6.5 mw-4 1.5],'String','Model Dimensions:');
for i = 1:n_m
    uicontrol('Parent',sum_panel,'Style','text','Units','character','HorizontalAlignment','left',...
        'Position', [4 Y_sum-6.5-1.5*i mw-4 1.5],'String',d_label{i});
end
uicontrol('Parent',sum_panel,'Style','text','Units','character','HorizontalAlignment','left',...
    'Position', [2 Y_sum-1.5*n_m-8 mw-4 1.5],'String',['Terrain: ' terrain '    Wind Speed: 1 ' ws_units]);

menu_panel = uipanel('Parent',fig,'BackgroundColor',clr,'Units','character','Position',[X0-mw 0 mw Y_menu],...
    'FontSize',12,'FontWeight','bold','TitlePosition','centertop','Title','Plotting Options');

mt = 2;
Ym = min([70 Y0-mt]);

A = 8;
B = 19.5;
C = 17;
D = 3;

menuA = uipanel('Parent',menu_panel,'BackgroundColor',clr,'Units','character','Position',[0 Y_menu-2-A mw-1 A],...
    'BorderType','none');
menuB = uipanel('Parent',menu_panel,'BackgroundColor',clr,'Units','character','Position',[0 Y_menu-2-(A+B) mw-1 B],...
    'FontSize',10,'FontWeight','bold','Title','Directional Influence Factors');
menuC = uipanel('Parent',menu_panel,'BackgroundColor',clr,'Units','character','Position',[0 Y_menu-2-(A+B+C) mw-1 C],...
    'FontSize',10,'FontWeight','bold','Title','Load Distributions');
menuD = uipanel('Parent',menu_panel,'BackgroundColor',clr,'Units','character','Position',[0 Y_menu-2-(A+B+C+D) mw-1 D],'BorderType','none');

%mb = 1;

frame_txt = uicontrol(menuA,'BackgroundColor',clr, 'Style', 'text', 'String','Select frame:',...
    'HorizontalAlignment','left','Units','characters','Position',[2 A-1.5 mw-4 1.5]);
frame_popup = uicontrol(menuA, 'Style', 'popupmenu', 'String',frame_label,'Value',1,...
    'Units','characters','Position',[2 A-3 mw-4 1.5],'BackgroundColor','w','Callback',@FrameSelectCallback );
resp_txt = uicontrol(menuA,'BackgroundColor',clr, 'Style', 'text', 'String','Select response:',...
    'HorizontalAlignment','left','Units','characters','Position',[2 A-5.5 mw-4 1.5]);
resp_popup = uicontrol(menuA, 'Style', 'popupmenu', 'String',resp_label,'Value',1,...
    'Units','characters','Position',[2 A-7 mw-4 1.5],'BackgroundColor','w','Callback',@RespSelectCallback );



maxmin_txt = uicontrol(menuB,'BackgroundColor',clr, 'Style', 'text', 'String','Type of peak:',...
    'HorizontalAlignment','left','Units','characters','Position',[2 B-3.5 mw-4 1.5]);
max_radio = uicontrol(menuB, 'Style','radiobutton','String','Maximum values','Value',1,...
    'Units','characters','Position',[4 B-5 mw-6 1.5],'Callback',@MaxCallback);
min_radio = uicontrol(menuB, 'Style','radiobutton','String','Minimum values','Value',1,...
    'Units','characters','Position',[4 B-6.5 mw-6 1.5],'Callback',@MinCallback);

pk_txt = uicontrol(menuB,'BackgroundColor',clr, 'Style', 'text', 'String','Peak evaluation method:',...
    'HorizontalAlignment','left','Units','characters','Position',[2 B-8.5 mw-4 1.5]);
obs_radio = uicontrol(menuB, 'Style','radiobutton','String','Observed peaks (sample max / min)','Value',1,...
    'Units','characters','Position',[4 B-10 mw-6 1.5],'Callback',@ObsPksCallback);
est_radio = uicontrol(menuB, 'Style','radiobutton','String','Estimated peaks (from probability distribution)','Value',0,...
    'Units','characters','Position',[4 B-11.5 mw-6 1.5],'Callback',@EstPksCallback);

sym_txt = uicontrol(menuB,'BackgroundColor',clr, 'Style', 'text', 'String','Results obtained by symmetry:',...
    'HorizontalAlignment','left','Units','characters','Position',[2 B-13.5 mw-4 1.5]);
ave_radio = uicontrol(menuB, 'Style','radiobutton','String','Averaged results (one for each wind direction)','Value',1,...
    'Enable','inactive','Units','characters','Position',[4 B-15 mw-6 1.5],'Callback',@AveCallback);
all_radio = uicontrol(menuB, 'Style','radiobutton','String','All results (Wind directions A, B, C, and D)','Value',0,...
    'Units','characters','Position',[4 B-16.5 mw-6 1.5],'Callback',@AllCallback);

interp_txt = uicontrol(menuB,'BackgroundColor',clr, 'Style', 'text', 'String','Results obtained by interpolation:',...
    'HorizontalAlignment','left','Units','characters','Position',[2 B-13.5 mw-4 1.5]);
interp_radio = uicontrol(menuB, 'Style','radiobutton','String','Interpolated results','Value',1,...
    'Units','characters','Position',[4 B-15 mw-6 1.5],'Callback',@InterpCallback);
intbnd_radio = uicontrol(menuB, 'Style','radiobutton','String','Results from bounding models','Value',0,...
    'Units','characters','Position',[4 B-16.5 mw-6 1.5],'Callback',@IntBndCallback);


if ~isfield(DIF_struct,'X_max_obs') || isempty(DIF_struct.X_max_obs)
    set(obs_radio, 'Value', 0);
    set(obs_radio, 'Enable', 'off');
    set(est_radio, 'Enable', 'inactive');
else % observed peaks available:
    X_max_obs = DIF_struct.X_max_obs;
    X_min_obs = DIF_struct.X_min_obs;
    if ~isfield(DIF_struct,'X_max_obs_all') || isempty(DIF_struct.X_max_obs_all)
        set(all_radio, 'Enable', 'off');
        set(ave_radio, 'Enable', 'inactive');
    else % symmetric results available:
        X_max_obs_all = DIF_struct.X_max_obs_all;
        X_min_obs_all = DIF_struct.X_min_obs_all;
    end
    if ~isfield(DIF_struct,'X_max_obs_bnd') || isempty(DIF_struct.X_max_obs_bnd)
        set(interp_txt, 'Visible','off','Enable','inactive');
        set(interp_radio, 'Value',0, 'Visible','off','Enable','inactive');
        set(intbnd_radio, 'Visible','off','Enable','inactive');
    else % bounding results available:
        X_max_obs_bnd = DIF_struct.X_max_obs_bnd;
        X_min_obs_bnd = DIF_struct.X_min_obs_bnd;
        set(sym_txt, 'Visible','off','Enable','inactive');
        set(ave_radio, 'Value',0, 'Visible','off','Enable','inactive');
        set(all_radio, 'Visible','off','Enable','inactive');
        symbol_list = {'+','x','s','d','*','^','v','>','<'};
    end
end    
if ~isfield(DIF_struct,'X_max_est') || isempty(DIF_struct.X_max_est)
    set(est_radio, 'Enable', 'off');
    set(obs_radio, 'Enable', 'inactive');
else % estimated peaks available:
    X_max_est = DIF_struct.X_max_est;
    X_min_est = DIF_struct.X_min_est;
    if ~isfield(DIF_struct,'X_max_est_all') || isempty(DIF_struct.X_max_est_all)
        set(all_radio, 'Enable', 'off');
        set(ave_radio, 'Enable', 'inactive');
    else % symmetric results available:
        X_max_est_all = DIF_struct.X_max_est_all;
        X_min_est_all = DIF_struct.X_min_est_all;
    end    
    if ~isfield(DIF_struct,'X_max_est_bnd') || isempty(DIF_struct.X_max_est_bnd)
        set(interp_txt, 'Visible','off','Enable','inactive');
        set(interp_radio, 'Value',0, 'Visible','off','Enable','inactive');
        set(intbnd_radio, 'Visible','off','Enable','inactive');
    else % bounding results available:
        X_max_est_bnd = DIF_struct.X_max_est_bnd;
        X_min_est_bnd = DIF_struct.X_min_est_bnd;
        set(sym_txt, 'Visible','off','Enable','inactive');
        set(ave_radio, 'Value',0, 'Visible','off','Enable','inactive');
        set(all_radio, 'Visible','off','Enable','inactive');
        symbol_list = {'+','x','s','d','*','^','v','>','<'};
    end
end


% % determine whether to display interpolation or symmetry plotting options:
% if n_m==1
%     set(interp_txt, 'Visible','off','Enable','inactive');
%     set(interp_radio, 'Value',0);
%     set(interp_radio, 'Visible','off','Enable','inactive');
%     set(intbnd_radio, 'Visible','off','Enable','inactive');
%     if ~isfield( DIF_struct, 'X_max_obs_all' )
%         set(all_radio, 'Enable','off');
%     end
% else
%     X_max_obs_bnd = DIF_struct.X_max_obs_bnd;
%     X_min_obs_bnd = DIF_struct.X_min_obs_bnd;
%     set(sym_txt, 'Visible','off','Enable','inactive');
%     set(ave_radio, 'Value',0);
%     set(ave_radio, 'Visible','off','Enable','inactive');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -