【材料力学】基于Matlab APP Designer 开发的绘制静定梁剪力、弯矩与挠曲线的软件

随便写点

这篇博客算是对上一篇绘制挠曲线博客的续写,之前编写的绘制挠曲线的程序还是有一些漏洞和缺点的(说白了就是有点烂),此外也仅仅可以求算铰支梁在受到集中力或者是集中力偶矩时的挠度。所以这次干脆一不做二不休(其实是懒得再去改那篇博客),在我之前程序的基础上,完成了之前缺失的悬臂梁以及均布载荷两部分内容,并将最后的核心代码做成了UI,方便使用,供大家交流参考。

一、前期程序架构

1.1静定梁类型划分

《材料力学》教材将静定的平面弯曲梁划分为三种基本形式简支梁、外伸梁和悬臂梁,如图所示:
材料力学教科书中对静定梁的分类
但是从程序设计的角度来看,这样的分类其实是有冗余与欠妥的。对于简支梁与外伸梁而言,其都是通过铰支座来实现平面中的静定,而且在求解挠曲线时、铰支座是对挠度做了限制,并未影响梁的转角。而相比之下,悬臂梁在求解集中力、集中力偶矩以及均布载荷时需要区分梁的“悬臂位置”是在左端面还是右端面,此外,悬臂梁不仅限制了端面处的挠度为零,同时也限制了端面处的转角为零。因此在设计程序时,我将静定梁的类型划分为:铰支梁、左端悬臂梁以及右端悬臂梁。如下图示意:

在这里插入图片描述
因此,我对梁所受到的所有外载荷(包含支座力以及悬臂弯矩)的正方向做出规定:规定集中力与均布载荷竖直向下为正方向,集中力偶矩顺时针为正方向。进一步地,为了后续便于程序的统一编写,我基于梁的长度尺寸对输入参数做了如下标准化,统一将梁的左端面定为坐标原点,将梁作为x坐标轴。因此,便可以得到支座位置、集中力、集中力偶矩以及均布载荷的起始点的坐标描述。

1.2软件UI设计

根据前文所述的使用需求,APP的界面需要拥有三个坐标图像绘制区,一个集中区域用来显示剪力、弯矩、挠度以及转角最值的大小以及位置信息,以及集中的输入与软件控制区域。根据这些设计需求,我设计的软件UI界面如下:在这里插入图片描述
并设计了四个控制按钮,”Run”、”Clean”、”Reset”以及”Close”。分别用来控制计算算例启动、绘图区堆积图像的清理、输入参数的一键归零以及程序窗口的关闭。在界面的右下角留有简单的使用说明,方便初次使用者使用。

1.3输入参数自动调整

程序采用了微元化的思想,将梁的总长度划分为50000份微元(调节UI中的fineness参数来变换微元数量,当梁较长时,可以根据需要提高微元数目)。而使用者输入的外载荷的位置可能不在微元划分后的“标准坐标点”上,因此,有必要使程序有能力自主修复使用者的输入参数。为了达到这一目的,同时为了便于后续计算过程的展开,在完成输入变量读取与合法性判断后,程序将通过axis_regularize()函数对使用者输入的参数进行二次处理。

function [axis] = axis_regularize(~,input,division_Value,number)  %将作用点'微移动'至标准微元点
	for i = 1:number
    	rate = input(i,1) / division_Value;
        input(i,1) = round(rate) * division_Value;
    end
    axis = input;
 end

二、算法分析与程序设计

2.1支座力转化

在静定梁的剪力与弯矩分析中,支座的力其实也可以视为两个集中力(铰支梁)或是一个集中力与一个集中力偶矩(悬臂梁),因此,在算法的开头步骤,首先计算出支座的集中力或是集中力偶矩,进而直接补充到信息输入时得到的Single_Force与Single_Torque矩阵,便可在后续通过统一的方法叠加计算,也与人工计算时的计算习惯相同。

2.1.1铰支梁

铰支梁受到的外载荷与支座力均依照正方向展示。根据第四章程序的输入参量处理,支座位置、均布载荷的起始位置以及集中力、集中力偶矩的施加位置分别记为: 在这里插入图片描述
可以得到在铰支梁的受力状态下,相应的平衡方程为:在这里插入图片描述
通过for循环遍历所有使用者输入的参数,基于叠加原理的思想将Support_B逐次叠加,最后利用整体的平衡方程求算出Support_A的大小。
完成支座力的解算后,对梁而言,实际上就是多了两个集中力,因此直接将解算得到的支座力添加到Single_Force矩阵中即可,而两个支座力的位置信息即是使用者输入得到的Position_Zeros向量。

if strcmp(State , '铰支梁')
   Support_B = 0;
   for i = 1:num_Force   %计算集中力对铰支座B的支座力
       Support_B = Support_B - (Single_Force(i,1) - ...
       Position_Zeros(1,1))*Single_Force(i,2)/(Position_Zeros(1,2) - Position_Zeros(1,1));
   end
   for i = 1:num_Torque  %计算集中力偶矩对支座B的支座力
       Support_B = Support_B - Single_Torque(i,2)/(Position_Zeros(2) - Position_Zeros(1)) ;
   end
   for i = 1:num_Load    %计算均布载荷对支座B的支座力
       Support_B = Support_B - Average_Load(i,3) * ( Average_Load(i,2) - Average_Load(i,1) ) ...
                            * (   (Average_Load(i,2) + Average_Load(i,1))/2  - Position_Zeros(1) )/...
                            ( Position_Zeros(2) - Position_Zeros(1));
   end
   Support_A = -Support_B - sum(Single_Force(:,2)) - sum(Average_Load(:,3).*(Average_Load(:,2) - Average_Load(:,1))); %求解综合B支座力与外载荷的影响下A支座的支座力
    Single_Force = [Single_Force ;
    Position_Zeros(1),Support_A;
    Position_Zeros(2),Support_B];%更新压力矩阵
end

2.1.2左端悬臂梁

左端悬臂梁不同于铰支梁,其支座力为集中力与集中力偶矩。因此,公式(2)修正为:
在这里插入图片描述

 if  strcmp(State , '左端悬臂梁')
	Support_Force = 0;
	Support_Torque = 0;
	for i = 1:num_Force %计算集中力对悬臂处的力影响
		Support_Force = Support_Force - Single_Force(i,2);
		Support_Torque = Support_Torque - Single_Force(i,1) * Single_Force(i,2);
	end
	for i = 1:num_Torque %计算集中力偶矩对悬臂处力的影响
		Support_Torque = Support_Torque - Single_Torque(i,2);
	end
	for i = 1:num_Load   %计算均布载荷对悬臂处力的影响
		Support_Force = Support_Force - Average_Load(i,3) * ( Average_Load(i,2) - Average_Load(i,1) );
		Support_Torque = Support_Torque - Average_Load(i,3) * ( Average_Load(i,2) - Average_Load(i,1)) ...
                            * (   (Average_Load(i,2) + Average_Load(i,1))/2  - 0 ) ;
	end
	Single_Force = [Single_Force;0,Support_Force];
	Single_Torque = [Single_Torque;0,Support_Torque];  %更新集中力与集中力偶矩矩阵,新力或力偶矩的坐标直接定为0
end

与铰支梁不同的是,悬臂梁的支座力多了集中力偶矩,因此在完成支座力求算后需要同时修改Single_Force矩阵与Single_Torque矩阵,且集中力与集中力偶矩的施加位置均为x=0处。

2.2剪力与弯矩叠加求算

经过2.1节对支座力的求算后,便可将梁的所有支座移去,仅针对现有的集中力、集中力偶矩以及均布载荷做叠加分析。

2.2.1 剪力求算

求算集中力时,参照《材料力学》中的方法,统一取坐标x处左侧的截面体分析。此时截面处的剪力向下为正,则可得集中力与均布载荷对截面处的剪力影响分别为:在这里插入图片描述

2.2.2 弯矩求算

同样地,求算弯矩时,仍取坐标x处左侧截面研究。集中力、集中力偶矩以及均布载荷对梁的弯矩均有影响,分别如:在这里插入图片描述
至此,可以得到与坐标向量x()对应的剪力向量Force()以及弯矩向量Torque()

 %%
                %叠加原理求算弯矩与剪力
                num_Force = size(Single_Force,1);
                num_Torque = size(Single_Torque,1); %更新荷载矩阵行数

                %集中力偶矩对弯矩与剪力的影响
                for i = 1:num_Torque
                    serial = Single_Torque(i,1) / division_Value ; %集中力偶矩的施加位置坐标除以分度精度得到对应的点在数组中的序号
                    if serial == 0
                        serial = 1;
                    end
                    Torque(serial:fineness) = Torque(serial:fineness) + Single_Torque(i,2);
                    %集中力偶矩对剪力没有影响
                end

                %集中力对弯矩及剪力的影响
                for i = 1:num_Force
                    for j = 1:fineness
                        if x(j) > Single_Force(i,1)
                            Force(j) = Force(j) - Single_Force(i,2);
                            Torque(j) = Torque(j) - Single_Force(i,2) * ( x(j) - Single_Force(i,1));
                        end
                    end
                end

                %均布载荷对弯矩与剪力的影响
                for i = 1:num_Load
                    for j =1 : fineness
                    if (x(j) > Average_Load(i,1)) %&& (x(j) <= Average_Load(i,2))
                        Force(j) = Force(j) - Average_Load(i,3) * ( x(j) - Average_Load(i,1) );
                        Torque(j) = Torque(j) - 0.5 * Average_Load(i,3)*(x(j) - Average_Load(i,1))^2;
                    end
                    if x(j)>Average_Load(i,2)
                        Force(j) = Force(j) + Average_Load(i,3) * (x(j) - Average_Load(i,2));
                        Torque(j) = Torque(j) + 0.5 * Average_Load(i,3) * ( x(j) - Average_Load(i,2))^2;
                    end
                    end
                end

2.3挠度求算

根据梁变形的微分方程,为了求出梁的挠曲线,可以使用积分法:在这里插入图片描述
其中C1、C2为积分常数,为方便表述,可以变为:
在这里插入图片描述
即分为不定积分部分与两个积分常数构成的线性部分,因此设计算法分别求解即可得到梁的挠度与转角值。

2.3.1数值不定积分求解

经过前文的求算后,程序已经得到了与梁长度微元x(:)逐一对应的弯矩值Torque( : )。因此我选择采用数值积分的方法,直接对每个微元处的弯矩值进行数值积分运算。我基于数值积分的梯形公式思想,将每个微元的弯矩大小与相邻的微元联合处理,求取三者的平均值来完成计算。即将弯矩的积分微元表示为:在这里插入图片描述
其中的division_Value为积分微元的长度,即根据使用者输入的精细度计算而来。
最后只需调用matlab的cumsum函数对两个向量逐位累加即可。至此,对于不定积分项的求解已经完成

                %% 两次数值积分求挠度
                for i = 2:fineness-1
                    Theta(i) = (Torque(i-1) + Torque(i) + Torque(i+1)) / 3 * division_Value ; %积分微元求算
                end
                Theta(1) = Theta(2);
                Theta(fineness) = Theta(fineness - 1); %边缘直接取等
                Theta = cumsum(Theta);   %累加积分
                Deflection = zeros(size(Theta));
                for i = 2:fineness-1
                    Deflection(i) = (Theta(i-1) + Theta(i) + Theta(i+1)) / 3 * division_Value;
                end
                Deflection(1) = Deflection(2);
                Deflection(fineness) = Deflection(fineness - 1);
                Deflection = cumsum(Deflection);
                %得到不定积分直接求积后的值

2.3.2 解算积分常数

需要根据梁的类型代入两个初值用以计算积分常数 。因为铰支梁在支座处有挠度为零、转角未必为零的性质;而悬臂梁在支座处有挠度、转角均为零的性质。三种类型的梁都可以基于其结构特点补充两个线性方程,因此可以利用克莱姆法则求解处积分常数。
对于铰支梁,可得线性方程组:
在这里插入图片描述
同理,对于左端悬臂梁,可得线性方程:在这里插入图片描述
类似的,对于右端悬臂梁,有:
在这里插入图片描述
使用克莱姆法则求解方程(20)或(22)或(23)后,将求得的 C1、C2值代入相应的挠度方程即可求得真实挠度。

                %得到不定积分直接求积后的值
                if strcmp(State , '铰支梁')
                    Serial_Position_Zero = Position_Zeros./division_Value;
                    if Serial_Position_Zero(1)==0
                        Serial_Position_Zero(1) = 1;
                    end
                    Serial_Position_Zero(2) = round( Serial_Position_Zero(2));
                    A =[x(int64(Serial_Position_Zero(1))) , 1;
                        x(int64(Serial_Position_Zero(2))), 1];
                    b = [-Deflection(int64(Serial_Position_Zero(1)));
                        -Deflection(int64(Serial_Position_Zero(2)))];
                    C = A\b;
                elseif strcmp(State , '左端悬臂梁')
                    A =[1 , 0;
                        0, 1];
                    b = [-Theta(1)      ;
                        -Deflection(1)];
                    C = A\b;
                elseif strcmp(State , '右端悬臂梁')
                    A =[1     , 0 ;
                        Length, 1];
                    b = [-Theta(fineness)      ;
                        -Deflection(fineness)];
                    C = A\b;
                end
                %C(1)为一次项系数,C(2)为常数项,得到真实的转角与挠度
                Deflection(1:fineness) = (Deflection(1:fineness) + C(1)*x(1:fineness)+C(2))/EI;
                Theta(1:fineness) = (Theta(1:fineness) + C(1))/EI;

三、程序源码

我将matlab APP Designer中的代码导出为.m文件,复制下列代码直接运行即可打开软件,同时我也将matlab APPDesigner的原版文件放在网盘中,大家可以自行下载使用,因为源码过长,先放网盘链接:

3.1网盘链接

链接:https://pan.baidu.com/s/1BiBs3eCIu6LVXnaAD4lBRw
提取码:VUlC

3.2真正源码

classdef Girder_Printer_exported < matlab.apps.AppBase

    % Properties that correspond to app components
    properties (Access = public)
        UIFigure              matlab.ui.Figure
        Label_10              matlab.ui.control.Label
        WaitingLampLabel_10   matlab.ui.control.Label
        WaitingLampLabel_9    matlab.ui.control.Label
        WaitingLampLabel_8    matlab.ui.control.Label
        WaitingLampLabel_7    matlab.ui.control.Label
        WaitingLampLabel_6    matlab.ui.control.Label
        WaitingLampLabel_5    matlab.ui.control.Label
        WaitingLampLabel_4    matlab.ui.control.Label
        WaitingLampLabel_3    matlab.ui.control.Label
        WaitingLampLabel_2    matlab.ui.control.Label
        Theta_Position        matlab.ui.control.NumericEditField
        Theta_Max             matlab.ui.control.NumericEditField
        mLabel_8              matlab.ui.control.Label
        radLabel              matlab.ui.control.Label
        Deflection_Position   matlab.ui.control.NumericEditField
        T_Min_Position        matlab.ui.control.NumericEditField
        T_Max_Position        matlab.ui.control.NumericEditField
        F_Min_Position        matlab.ui.control.NumericEditField
        F_Max_Position        matlab.ui.control.NumericEditField
        Deflection_Max        matlab.ui.control.NumericEditField
        Torque_Min            matlab.ui.control.NumericEditField
        Torque_Max            matlab.ui.control.NumericEditField
        Force_Min             matlab.ui.control.NumericEditField
        Force_Max             matlab.ui.control.NumericEditField
        mLabel_6              matlab.ui.control.Label
        mLabel_5              matlab.ui.control.Label
        mLabel_4              matlab.ui.control.Label
        mLabel_3              matlab.ui.control.Label
        mLabel_2              matlab.ui.control.Label
        mLabel                matlab.ui.control.Label
        NmLabel_2             matlab.ui.control.Label
        NmLabel               matlab.ui.control.Label
        NLabel_2              matlab.ui.control.Label
        NLabel                matlab.ui.control.Label
        KeyPointsLabel        matlab.ui.control.Label
        PlotLabel             matlab.ui.control.Label
        ControlInputPanel     matlab.ui.container.Panel
        Button_Reset          matlab.ui.control.Button
        WaitingLamp           matlab.ui.control.Lamp
        WaitingLampLabel      matlab.ui.control.Label
        Label_9               matlab.ui.control.Label
        Label_8               matlab.ui.control.Label
        Edit_Input_Load       matlab.ui.control.EditField
        Edit_Input_Torque     matlab.ui.control.EditField
        Label_7               matlab.ui.control.Label
        Label_6               matlab.ui.control.Label
        Edit_Input_Force      matlab.ui.control.EditField
        Label_5               matlab.ui.control.Label
        Edit_Fineness         matlab.ui.control.NumericEditField
        Edit_EI               matlab.ui.control.NumericEditField
        Nm2Label              matlab.ui.control.Label
        Label_3               matlab.ui.control.Label
        Button_Close          matlab.ui.control.Button
        Button_Clean          matlab.ui.control.Button
        PoweredbyVulcanLabel  matlab.ui.control.Label
        Position_Zero         matlab.ui.control.EditField
        Label_2               matlab.ui.control.Label
        Button_Run            matlab.ui.control.Button
        Edit_Length           matlab.ui.control.NumericEditField
        mEditFieldLabel       matlab.ui.control.Label
        TypeBeam              matlab.ui.control.DropDown
        Label                 matlab.ui.control.Label
        Axes_Deflection       matlab.ui.control.UIAxes
        Axes_Torque           matlab.ui.control.UIAxes
        Axes_Force            matlab.ui.control.UIAxes
    end


    methods (Access = private)
        function [Legitimacy] = Input_Judge(~,Length,Position_Zeros,Single_Force,Single_Torque,Average_Load,fineness)
            max_Pos = max([Position_Zeros,Single_Force(:,1)',Single_Torque(:,1)',Average_Load(:,1)', ...
                Average_Load(:,2)']);
            min_Pos = min([Position_Zeros,Single_Force(:,1)',Single_Torque(:,1)',Average_Load(:,1)', ...
                Average_Load(:,2)']);
            if (rem(fineness,1) ~= 0)
                answer = 0;
            elseif max_Pos > Length
                answer = 0;
            elseif min_Pos < 0
                answer = 0;
            else
                answer = 1;
            end
            Legitimacy = answer;
        end
        function [axis] = axis_regularize(~,input,division_Value,number)  %将作用点'微移动'至标准微元点
            for i = 1:number
                rate = input(i,1) / division_Value;
                input(i,1) = round(rate) * division_Value;
            end
            axis = input;
        end
    end


    % Callbacks that handle component events
    methods (Access = private)

        % Button pushed function: Button_Run
        function Button_RunPushed(app, event)
            app.WaitingLampLabel.Text = 'Working';
            app.WaitingLamp.Color = [0.93,0.43,0.24];
            pause(0.01); %延时保证指示灯变色
            EI = app.Edit_EI.Value;
            Length = app.Edit_Length.Value;
            fineness = app.Edit_Fineness.Value;
            Position_Zeros = str2num(app.Position_Zero.Value);
            Single_Force = str2num(app.Edit_Input_Force.Value);
            Single_Torque = str2num(app.Edit_Input_Torque.Value);
            Average_Load = str2num(app.Edit_Input_Load.Value);
            Legitimacy = Input_Judge(app,Length,Position_Zeros,Single_Force,Single_Torque,Average_Load,fineness);
            if Legitimacy == 1
                State = char(app.TypeBeam.Value);
                num_Force = size(Single_Force,1);
                num_Torque = size(Single_Torque,1); %求解集中力与集中力偶矩的个数
                num_Load = size(Average_Load,1); %求解均布载荷个数
                division_Value = Length/fineness ; %定义梁长度分度值
                Single_Torque = axis_regularize(app,Single_Torque,division_Value,num_Torque);
                Single_Force = axis_regularize(app,Single_Force,division_Value,num_Force);
                %% 求解运算(求解支座力)
                x = linspace(0,Length,fineness);%将梁按照精细度划分
                Force = zeros(size(x));
                Torque = zeros(size(x));
                Theta = zeros(size(x));
                if strcmp(State , '铰支梁')
                    Support_B = 0;
                    for i = 1:num_Force   %计算集中力对铰支座B的支座力
                        Support_B = Support_B - (Single_Force(i,1) - ...
                            Position_Zeros(1,1))*Single_Force(i,2)/(Position_Zeros(1,2) - Position_Zeros(1,1));
                    end
                    for i = 1:num_Torque  %计算集中力偶矩对支座B的支座力
                        Support_B = Support_B - Single_Torque(i,2)/(Position_Zeros(2) - Position_Zeros(1)) ;
                    end
                    for i = 1:num_Load    %计算均布载荷对支座B的支座力
                        Support_B = Support_B - Average_Load(i,3) * ( Average_Load(i,2) - Average_Load(i,1) ) ...
                            * (   (Average_Load(i,2) + Average_Load(i,1))/2  - Position_Zeros(1) ) /...
                            ( Position_Zeros(2) - Position_Zeros(1));
                    end
                    Support_A = -Support_B - sum(Single_Force(:,2)) - sum(Average_Load(:,3).*(Average_Load(:,2) - Average_Load(:,1))); %求解综合B支座力与外载荷的影响下A支座的支座力
                    Single_Force = [Single_Force ;
                        Position_Zeros(1),Support_A;
                        Position_Zeros(2),Support_B];%更新压力矩阵
                end
                if  strcmp(State , '左端悬臂梁')
                    Support_Force = 0;
                    Support_Torque = 0;
                    for i = 1:num_Force %计算集中力对悬臂处的力影响
                        Support_Force = Support_Force - Single_Force(i,2);
                        Support_Torque = Support_Torque - Single_Force(i,1) * Single_Force(i,2);
                    end
                    for i = 1:num_Torque %计算集中力偶矩对悬臂处力的影响
                        Support_Torque = Support_Torque - Single_Torque(i,2);
                    end
                    for i = 1:num_Load   %计算均布载荷对悬臂处力的影响
                        Support_Force = Support_Force - Average_Load(i,3) * ( Average_Load(i,2) - Average_Load(i,1) );
                        Support_Torque = Support_Torque - Average_Load(i,3) * ( Average_Load(i,2) - Average_Load(i,1) ) ...
                            * (   (Average_Load(i,2) + Average_Load(i,1))/2  - 0 ) ;
                    end
                    Single_Force = [Single_Force;0,Support_Force];
                    Single_Torque = [Single_Torque;0,Support_Torque];  %更新集中力与集中力偶矩矩阵,新力或力偶矩的坐标直接定为0
                end
                if  strcmp(State , '右端悬臂梁')
                    Support_Force = 0;
                    Support_Torque = 0;
                    for i = 1:num_Force %计算集中力对悬臂处的力影响
                        Support_Force = Support_Force - Single_Force(i,2);
                        Support_Torque = Support_Torque + Single_Force(i,2) *(Length - Single_Force(i,1));
                    end
                    for i = 1:num_Torque %计算集中力偶矩对悬臂处力的影响
                        Support_Torque = Support_Torque - Single_Torque(i,2);
                    end
                    for i = 1:num_Load   %计算均布载荷对悬臂处力的影响
                        Support_Force = Support_Force - Average_Load(i,3) * ( Average_Load(i,2) - Average_Load(i,1) );
                        Support_Torque = Support_Torque + Average_Load(i,3) * ( Average_Load(i,2) - Average_Load(i,1) ) ...
                            * (  Length - (Average_Load(i,2) + Average_Load(i,1))/2   ) ;
                    end
                    Single_Force = [Single_Force;Length,Support_Force];
                    Single_Torque = [Single_Torque;Length,Support_Torque];
                end
                %%
                %叠加原理求算弯矩与剪力
                num_Force = size(Single_Force,1);
                num_Torque = size(Single_Torque,1); %更新荷载矩阵行数

                %集中力偶矩对弯矩与剪力的影响
                for i = 1:num_Torque
                    serial = Single_Torque(i,1) / division_Value ; %集中力偶矩的施加位置坐标除以分度精度得到对应的点在数组中的序号
                    if serial == 0
                        serial = 1;
                    end
                    Torque(serial:fineness) = Torque(serial:fineness) + Single_Torque(i,2);
                    %集中力偶矩对剪力没有影响
                end

                %集中力对弯矩及剪力的影响
                for i = 1:num_Force
                    for j = 1:fineness
                        if x(j) > Single_Force(i,1)
                            Force(j) = Force(j) - Single_Force(i,2);
                            Torque(j) = Torque(j) - Single_Force(i,2) * ( x(j) - Single_Force(i,1));
                        end
                    end
                end

                %均布载荷对弯矩与剪力的影响
                for i = 1:num_Load
                    for j =1 : fineness
                    if (x(j) > Average_Load(i,1)) %&& (x(j) <= Average_Load(i,2))
                        Force(j) = Force(j) - Average_Load(i,3) * ( x(j) - Average_Load(i,1) );
                        Torque(j) = Torque(j) - 0.5 * Average_Load(i,3)*(x(j) - Average_Load(i,1))^2;
                    end
                    if x(j)>Average_Load(i,2)
                        Force(j) = Force(j) + Average_Load(i,3) * (x(j) - Average_Load(i,2));
                        Torque(j) = Torque(j) + 0.5 * Average_Load(i,3) * ( x(j) - Average_Load(i,2))^2;
                    end
                    end
                end

                %% 两次数值积分求挠度
                for i = 2:fineness-1
                    Theta(i) = (Torque(i-1) + Torque(i) + Torque(i+1)) / 3 * division_Value ; %积分微元求算
                end
                Theta(1) = Theta(2);
                Theta(fineness) = Theta(fineness - 1); %边缘直接取等
                Theta = cumsum(Theta);   %累加积分
                Deflection = zeros(size(Theta));
                for i = 2:fineness-1
                    Deflection(i) = (Theta(i-1) + Theta(i) + Theta(i+1)) / 3 * division_Value;
                end
                Deflection(1) = Deflection(2);
                Deflection(fineness) = Deflection(fineness - 1);
                Deflection = cumsum(Deflection);
                %得到不定积分直接求积后的值
                if strcmp(State , '铰支梁')
                    Serial_Position_Zero = Position_Zeros./division_Value;
                    if Serial_Position_Zero(1)==0
                        Serial_Position_Zero(1) = 1;
                    end
                    Serial_Position_Zero(2) = round( Serial_Position_Zero(2));
                    A =[x(int64(Serial_Position_Zero(1))) , 1;
                        x(int64(Serial_Position_Zero(2))), 1];
                    b = [-Deflection(int64(Serial_Position_Zero(1)));
                        -Deflection(int64(Serial_Position_Zero(2)))];
                    C = A\b;
                elseif strcmp(State , '左端悬臂梁')
                    A =[1 , 0;
                        0, 1];
                    b = [-Theta(1)      ;
                        -Deflection(1)];
                    C = A\b;
                elseif strcmp(State , '右端悬臂梁')
                    A =[1     , 0 ;
                        Length, 1];
                    b = [-Theta(fineness)      ;
                        -Deflection(fineness)];
                    C = A\b;
                end
                %C(1)为一次项系数,C(2)为常数项,得到真实的转角与挠度
                Deflection(1:fineness) = (Deflection(1:fineness) + C(1)*x(1:fineness)+C(2))/EI;
                Theta(1:fineness) = (Theta(1:fineness) + C(1))/EI;
                %% 查询最值
                % 挠度
                Max_Deflection = max(abs(Deflection(1:fineness)));
                for i = 1:fineness
                    if abs(Deflection(i)) == Max_Deflection
                        app.Deflection_Max.Value = Deflection(i);
                        app.Deflection_Position.Value = x(i);
                        break;
                    end
                end
                % 转角
                Max_Theta = max(abs(Theta(1:fineness)));
                Serial_Max_Theta = 0;
                for i = 1:fineness
                    if abs(Theta(i)) == Max_Theta
                        app.Theta_Max.Value = Theta(i);
                        app.Theta_Position.Value = x(i);
                        Serial_Max_Theta = i;
                        break;
                    end
                end
                %剪力Max
                Max_Force = max(abs(Force(1:fineness)));
                for i = 1:fineness
                    if abs(Force(i)) == Max_Force
                        app.Force_Max.Value = Force(i);
                        app.F_Max_Position.Value = x(i);
                        break;
                    end
                end
                %剪力Min
                Min_Force = min(abs(Force(1:fineness)));
                for i = 1:fineness
                    if abs(Force(i)) == Min_Force
                        app.Force_Min.Value = Force(i);
                        app.F_Min_Position.Value = x(i);
                        break;
                    end
                end
                %弯矩Max
                Max_Torque = max(abs(Torque(1:fineness)));
                for i = 1:fineness
                    if abs(Torque(i)) == Max_Torque
                        app.Torque_Max.Value = Torque(i);
                        app.T_Max_Position.Value = x(i);
                        break;
                    end
                end
                %弯矩Min
                Min_Torque = min(abs(Torque(1:fineness)));
                for i = 1:fineness
                    if abs(Torque(i)) == Min_Torque
                        app.Torque_Min.Value = Torque(i);
                        app.T_Min_Position.Value = x(i);
                        break;
                    end
                end

                %得到真值最值,用于变换坐标区最值
                F_Max = max(Force(:));
                F_Min = min(Force(:));
                T_Max = max(Torque(:));
                T_Min = min(Torque(:));
                D_Max = max(Deflection(:));
                D_Min = min(Deflection(:));
                A_F = F_Max - F_Min;
                A_T = T_Max - T_Min;
                A_D = D_Max - D_Min;

                %绘制剪力图,90%的区域显示图像
                plot(app.Axes_Force,x,Force,'LineWidth',1);
                hold(app.Axes_Force,'on');
                plot(app.Axes_Force,[0,Length],[0,0],'LineStyle',':','Color',[0.06,0.55,0.59],'LineWidth',1.5);
                scatter(app.Axes_Force,[app.F_Min_Position.Value,app.F_Max_Position.Value],...
                    [app.Force_Min.Value,app.Force_Max.Value],'s','LineWidth',1.2);  %标记最值点
                Y_Lim_F = app.Axes_Force.YLim;
                if (Y_Lim_F(2)-F_Max) < 0.05 * A_F
                    app.Axes_Force.YLim(2) = F_Max + 0.05 * A_F;
                end
                if (F_Min - Y_Lim_F(1)) < 0.05 * A_F
                    app.Axes_Force.YLim(1) = F_Min - 0.05 * A_F;
                end


                %绘制弯矩图
                plot (app.Axes_Torque,x,Torque,'LineWidth',1);
                hold (app.Axes_Torque,'on');
                plot(app.Axes_Torque,[0,Length],[0,0],'LineStyle',':','Color',[0.06,0.55,0.59],'LineWidth',1.5)
                scatter(app.Axes_Torque,[app.T_Min_Position.Value,app.T_Max_Position.Value],...
                    [app.Torque_Min.Value,app.Torque_Max.Value],'s','LineWidth',1.2);
                app.Axes_Torque.YDir = 'reverse';
                Y_Lim_T = app.Axes_Torque.YLim;
                if (Y_Lim_T(2)-T_Max) < 0.05 * A_T
                    app.Axes_Torque.YLim(2) = T_Max + 0.05 * A_T;
                end
                if (T_Min - Y_Lim_T(1)) < 0.05 * A_T
                    app.Axes_Torque.YLim(1) = T_Min - 0.05 * A_T;
                end

                %绘制挠曲线
                plot(app.Axes_Deflection,x,Deflection,'LineStyle','-.','LineWidth',1);
                hold(app.Axes_Deflection,'on');
                plot(app.Axes_Deflection,[0,Length],[0,0],'Color',[0.06,0.55,0.59],'LineWidth',1.5)
                if strcmp(State , '铰支梁')
                    scatter(app.Axes_Deflection,Position_Zeros,[0,0],'filled');
                elseif strcmp(State , '左端悬臂梁')
                    scatter(app.Axes_Deflection,0,0,'filled');
                elseif strcmp(State , '右端悬臂梁')
                    scatter(app.Axes_Deflection,Length,0,'filled');
                end
                scatter(app.Axes_Deflection,app.Deflection_Position.Value,app.Deflection_Max.Value,'s','LineWidth',1.2);
                scatter(app.Axes_Deflection,app.Theta_Position.Value,Deflection(Serial_Max_Theta),'d','LineWidth',1.2)
                Y_Lim_D = app.Axes_Deflection.YLim;
                if (Y_Lim_D(2)-D_Max) < 0.05 * A_D
                    app.Axes_Deflection.YLim(2) = D_Max + 0.05 * A_D;
                end
                if (D_Min - Y_Lim_D(1)) < 0.05 * A_D
                    app.Axes_Deflection.YLim(1) = D_Min - 0.05 * A_D;
                end
            else
                uiconfirm(app.UIFigure,'输入信息有误,请检查输入','输入信息出错',...
                'Options',{'确认'});
            end
            app.WaitingLampLabel.Text = 'Waiting';
            app.WaitingLamp.Color = [0.20,0.44,0.68];
        end

        % Button pushed function: Button_Clean
        function Button_CleanPushed(app, event)
            cla(app.Axes_Deflection,'reset');
            cla(app.Axes_Force,'reset');
            cla(app.Axes_Torque,'reset');
            app.T_Max_Position.Value = 0;
            app.T_Min_Position.Value = 0;
            app.F_Max_Position.Value = 0;
            app.F_Min_Position.Value = 0;
            app.Force_Max.Value = 0;
            app.Force_Min.Value = 0;
            app.Torque_Max.Value = 0;
            app.Torque_Min.Value = 0;
            app.Theta_Position.Value = 0;
            app.Theta_Max.Value = 0;
            app.Deflection_Max.Value = 0;
            app.Deflection_Position.Value = 0;
%             app.Axes_Deflection.YLim = [0,1];
%             app.Axes_Force.YLim = [0,1];
%             app.Axes_Torque.YLim = [0,1];
        end

        % Button pushed function: Button_Close
        function Button_ClosePushed(app, event)
            %
            uiconfirm(app.UIFigure,'请确认是否需要关闭当前窗口','关闭前确认',...
                'Options',{'确认','取消'},'DefaultOption',2,'CancelOption',2,...
                'CloseFcn',@CloseFcnForFigure);
            function CloseFcnForFigure ( source,event)
                switch event.SelectedOption
                    case '取消'
                    case '确认';delete(source);app = [];
                end
            end
        end

        % Value changed function: TypeBeam
        function TypeBeamValueChanged(app, event)
            %UI控制,悬臂梁状态下禁用铰支位置输入
            value = app.TypeBeam.Value;
            if strcmp(value , '铰支梁')
                app.Position_Zero.Enable = 'on' ;
            elseif strcmp(value , '左端悬臂梁')
                app.Position_Zero.Enable = 'off';
            elseif strcmp(value ,'右端悬臂梁')
                app.Position_Zero.Enable = 'off';
            end
        end

        % Button pushed function: Button_Reset
        function Button_ResetPushed(app, event)
            app.Edit_Input_Force.Value = '0,0;';
            app.Edit_Input_Torque.Value = '0,0;';
            app.Edit_Input_Load.Value = '0,0,0;';
        end
    end

    % Component initialization
    methods (Access = private)

        % Create UIFigure and components
        function createComponents(app)

            % Create UIFigure and hide until all components are created
            app.UIFigure = uifigure('Visible', 'off');
            app.UIFigure.Color = [1 1 1];
            app.UIFigure.Position = [100 100 1173 652];
            app.UIFigure.Name = 'MATLAB App';
            app.UIFigure.Tag = 'F_Max_Position';

            % Create Axes_Force
            app.Axes_Force = uiaxes(app.UIFigure);
            app.Axes_Force.Color = 'none';
            app.Axes_Force.FontSize = 12;
            app.Axes_Force.Box = 'on';
            app.Axes_Force.Tag = 'Axes_Force';
            app.Axes_Force.Position = [29 324 343 295];

            % Create Axes_Torque
            app.Axes_Torque = uiaxes(app.UIFigure);
            zlabel(app.Axes_Torque, 'Z')
            app.Axes_Torque.YDir = 'reverse';
            app.Axes_Torque.Box = 'on';
            app.Axes_Torque.Tag = 'Axes_Torque';
            app.Axes_Torque.Position = [29 19 343 295];

            % Create Axes_Deflection
            app.Axes_Deflection = uiaxes(app.UIFigure);
            zlabel(app.Axes_Deflection, 'Z')
            app.Axes_Deflection.Box = 'on';
            app.Axes_Deflection.Tag = 'Axes_Deflection';
            app.Axes_Deflection.Position = [387 324 343 295];

            % Create ControlInputPanel
            app.ControlInputPanel = uipanel(app.UIFigure);
            app.ControlInputPanel.ForegroundColor = [0.0588 0.549 0.5882];
            app.ControlInputPanel.BorderType = 'none';
            app.ControlInputPanel.TitlePosition = 'centertop';
            app.ControlInputPanel.Title = 'Control & Input';
            app.ControlInputPanel.BackgroundColor = [1 1 1];
            app.ControlInputPanel.FontName = '3ds Light';
            app.ControlInputPanel.FontWeight = 'bold';
            app.ControlInputPanel.FontSize = 15;
            app.ControlInputPanel.Position = [766 1 408 651];

            % Create Label
            app.Label = uilabel(app.ControlInputPanel);
            app.Label.FontName = '3ds Light';
            app.Label.FontSize = 13;
            app.Label.FontWeight = 'bold';
            app.Label.FontColor = [0.902 0.6588 0.2902];
            app.Label.Position = [20 586 61 22];
            app.Label.Text = '梁的类型';

            % Create TypeBeam
            app.TypeBeam = uidropdown(app.ControlInputPanel);
            app.TypeBeam.Items = {'铰支梁', '左端悬臂梁', '右端悬臂梁'};
            app.TypeBeam.ValueChangedFcn = createCallbackFcn(app, @TypeBeamValueChanged, true);
            app.TypeBeam.Tag = 'TypeBeam';
            app.TypeBeam.FontWeight = 'bold';
            app.TypeBeam.FontColor = [0.2 0.4392 0.6784];
            app.TypeBeam.Position = [119 584 161 25];
            app.TypeBeam.Value = '铰支梁';

            % Create mEditFieldLabel
            app.mEditFieldLabel = uilabel(app.ControlInputPanel);
            app.mEditFieldLabel.FontSize = 13;
            app.mEditFieldLabel.FontWeight = 'bold';
            app.mEditFieldLabel.FontColor = [0.902 0.6588 0.2902];
            app.mEditFieldLabel.Position = [20 517 61 22];
            app.mEditFieldLabel.Text = '总长度(m)';

            % Create Edit_Length
            app.Edit_Length = uieditfield(app.ControlInputPanel, 'numeric');
            app.Edit_Length.Limits = [0 Inf];
            app.Edit_Length.Tag = 'Edit_Length';
            app.Edit_Length.HorizontalAlignment = 'center';
            app.Edit_Length.FontName = '3ds Light';
            app.Edit_Length.FontSize = 13;
            app.Edit_Length.FontWeight = 'bold';
            app.Edit_Length.FontColor = [0.2 0.4392 0.6784];
            app.Edit_Length.Position = [89 515 89 25];
            app.Edit_Length.Value = 1;

            % Create Button_Run
            app.Button_Run = uibutton(app.ControlInputPanel, 'push');
            app.Button_Run.ButtonPushedFcn = createCallbackFcn(app, @Button_RunPushed, true);
            app.Button_Run.Tag = 'B\utton_Run';
            app.Button_Run.FontName = '3ds Light';
            app.Button_Run.FontSize = 15;
            app.Button_Run.FontWeight = 'bold';
            app.Button_Run.FontColor = [0.651 0.2196 0.4];
            app.Button_Run.Position = [19 155 72 27];
            app.Button_Run.Text = 'Run';

            % Create Label_2
            app.Label_2 = uilabel(app.ControlInputPanel);
            app.Label_2.FontSize = 13;
            app.Label_2.FontWeight = 'bold';
            app.Label_2.FontColor = [0.902 0.6588 0.2902];
            app.Label_2.Position = [20 448 61 22];
            app.Label_2.Text = '铰支位置';

            % Create Position_Zero
            app.Position_Zero = uieditfield(app.ControlInputPanel, 'text');
            app.Position_Zero.Tag = 'Position_Zero';
            app.Position_Zero.HorizontalAlignment = 'center';
            app.Position_Zero.FontName = '3ds Light';
            app.Position_Zero.FontSize = 13;
            app.Position_Zero.FontWeight = 'bold';
            app.Position_Zero.FontColor = [0.2 0.4392 0.6784];
            app.Position_Zero.Position = [89 447 89 25];
            app.Position_Zero.Value = '0,1';

            % Create PoweredbyVulcanLabel
            app.PoweredbyVulcanLabel = uilabel(app.ControlInputPanel);
            app.PoweredbyVulcanLabel.HorizontalAlignment = 'right';
            app.PoweredbyVulcanLabel.FontName = '3ds Light';
            app.PoweredbyVulcanLabel.FontColor = [0.502 0.502 0.502];
            app.PoweredbyVulcanLabel.Position = [1 1 408 25];
            app.PoweredbyVulcanLabel.Text = 'Powered by Vulcan      ';

            % Create Button_Clean
            app.Button_Clean = uibutton(app.ControlInputPanel, 'push');
            app.Button_Clean.ButtonPushedFcn = createCallbackFcn(app, @Button_CleanPushed, true);
            app.Button_Clean.Tag = 'Button_Clean';
            app.Button_Clean.FontName = '3ds Light';
            app.Button_Clean.FontSize = 15;
            app.Button_Clean.FontWeight = 'bold';
            app.Button_Clean.FontColor = [0.651 0.2196 0.4];
            app.Button_Clean.Position = [117 155 72 27];
            app.Button_Clean.Text = 'Clean';

            % Create Button_Close
            app.Button_Close = uibutton(app.ControlInputPanel, 'push');
            app.Button_Close.ButtonPushedFcn = createCallbackFcn(app, @Button_ClosePushed, true);
            app.Button_Close.Tag = 'Button_Close';
            app.Button_Close.FontName = '3ds Light';
            app.Button_Close.FontSize = 15;
            app.Button_Close.FontWeight = 'bold';
            app.Button_Close.FontColor = [0.651 0.2196 0.4];
            app.Button_Close.Position = [312 155 72 27];
            app.Button_Close.Text = 'Close';

            % Create Label_3
            app.Label_3 = uilabel(app.ControlInputPanel);
            app.Label_3.FontName = '3ds Light';
            app.Label_3.FontSize = 13;
            app.Label_3.FontWeight = 'bold';
            app.Label_3.FontColor = [0.902 0.6588 0.2902];
            app.Label_3.Position = [21 377 81 22];
            app.Label_3.Text = {'集中力'; ''};

            % Create Nm2Label
            app.Nm2Label = uilabel(app.ControlInputPanel);
            app.Nm2Label.HorizontalAlignment = 'center';
            app.Nm2Label.FontName = '3ds Light';
            app.Nm2Label.FontSize = 13;
            app.Nm2Label.FontWeight = 'bold';
            app.Nm2Label.FontColor = [0.902 0.6588 0.2902];
            app.Nm2Label.Position = [185 517 106 22];
            app.Nm2Label.Text = '弯曲刚度(N·m^2)';

            % Create Edit_EI
            app.Edit_EI = uieditfield(app.ControlInputPanel, 'numeric');
            app.Edit_EI.Limits = [1e-08 Inf];
            app.Edit_EI.Tag = 'Edit_EI';
            app.Edit_EI.HorizontalAlignment = 'center';
            app.Edit_EI.FontName = '3ds Light';
            app.Edit_EI.FontSize = 13;
            app.Edit_EI.FontWeight = 'bold';
            app.Edit_EI.FontColor = [0.2 0.4392 0.6784];
            app.Edit_EI.Position = [297 515 89 25];
            app.Edit_EI.Value = 1;

            % Create Edit_Fineness
            app.Edit_Fineness = uieditfield(app.ControlInputPanel, 'numeric');
            app.Edit_Fineness.Limits = [500 Inf];
            app.Edit_Fineness.Tag = 'Edit_Fineness';
            app.Edit_Fineness.HorizontalAlignment = 'center';
            app.Edit_Fineness.FontName = '3ds Light';
            app.Edit_Fineness.FontSize = 13;
            app.Edit_Fineness.FontWeight = 'bold';
            app.Edit_Fineness.FontColor = [0.2 0.4392 0.6784];
            app.Edit_Fineness.Position = [295 447 89 25];
            app.Edit_Fineness.Value = 50000;

            % Create Label_5
            app.Label_5 = uilabel(app.ControlInputPanel);
            app.Label_5.HorizontalAlignment = 'center';
            app.Label_5.FontName = '3ds Light';
            app.Label_5.FontSize = 13;
            app.Label_5.FontWeight = 'bold';
            app.Label_5.FontColor = [0.902 0.6588 0.2902];
            app.Label_5.Position = [202 448 72 22];
            app.Label_5.Text = '精细度';

            % Create Edit_Input_Force
            app.Edit_Input_Force = uieditfield(app.ControlInputPanel, 'text');
            app.Edit_Input_Force.Tag = 'Edit_Input_Force';
            app.Edit_Input_Force.HorizontalAlignment = 'center';
            app.Edit_Input_Force.FontName = '3ds Light';
            app.Edit_Input_Force.FontSize = 13;
            app.Edit_Input_Force.FontWeight = 'bold';
            app.Edit_Input_Force.FontColor = [0.2 0.4392 0.6784];
            app.Edit_Input_Force.Position = [119 373 266 31];
            app.Edit_Input_Force.Value = '0,0;';

            % Create Label_6
            app.Label_6 = uilabel(app.ControlInputPanel);
            app.Label_6.FontName = '3ds Light';
            app.Label_6.FontSize = 13;
            app.Label_6.FontWeight = 'bold';
            app.Label_6.FontColor = [0.902 0.6588 0.2902];
            app.Label_6.Position = [20 303 81 22];
            app.Label_6.Text = {'集中力偶矩'; ''};

            % Create Label_7
            app.Label_7 = uilabel(app.ControlInputPanel);
            app.Label_7.FontName = '3ds Light';
            app.Label_7.FontSize = 13;
            app.Label_7.FontWeight = 'bold';
            app.Label_7.FontColor = [0.902 0.6588 0.2902];
            app.Label_7.Position = [20 229 81 22];
            app.Label_7.Text = '均布载荷';

            % Create Edit_Input_Torque
            app.Edit_Input_Torque = uieditfield(app.ControlInputPanel, 'text');
            app.Edit_Input_Torque.Tag = 'Edit_Input_Torque';
            app.Edit_Input_Torque.HorizontalAlignment = 'center';
            app.Edit_Input_Torque.FontName = '3ds Light';
            app.Edit_Input_Torque.FontSize = 13;
            app.Edit_Input_Torque.FontWeight = 'bold';
            app.Edit_Input_Torque.FontColor = [0.2 0.4392 0.6784];
            app.Edit_Input_Torque.Position = [119 299 266 31];
            app.Edit_Input_Torque.Value = '0.5,0;';

            % Create Edit_Input_Load
            app.Edit_Input_Load = uieditfield(app.ControlInputPanel, 'text');
            app.Edit_Input_Load.Tag = 'Edit_Input_Load';
            app.Edit_Input_Load.HorizontalAlignment = 'center';
            app.Edit_Input_Load.FontName = '3ds Light';
            app.Edit_Input_Load.FontSize = 13;
            app.Edit_Input_Load.FontWeight = 'bold';
            app.Edit_Input_Load.FontColor = [0.2 0.4392 0.6784];
            app.Edit_Input_Load.Position = [119 225 266 31];
            app.Edit_Input_Load.Value = '0,1,1;';

            % Create Label_8
            app.Label_8 = uilabel(app.ControlInputPanel);
            app.Label_8.HorizontalAlignment = 'right';
            app.Label_8.FontName = '3ds Light';
            app.Label_8.FontSize = 13;
            app.Label_8.FontColor = [0.502 0.502 0.502];
            app.Label_8.Position = [172 20 237 19];
            app.Label_8.Text = '输入多组荷载时请用分号隔开😋    ';

            % Create Label_9
            app.Label_9 = uilabel(app.ControlInputPanel);
            app.Label_9.HorizontalAlignment = 'right';
            app.Label_9.VerticalAlignment = 'top';
            app.Label_9.FontName = '3ds Light';
            app.Label_9.FontSize = 13;
            app.Label_9.FontColor = [0.502 0.502 0.502];
            app.Label_9.Position = [28 40 381 93];
            app.Label_9.Text = {'精细度为有限元数目,适当增大可以提高绘图精确度,  '; '但会延长计算时间;👍     '; '集中力与集中力偶矩的输入为“位置,大小”,  '; '均布载荷的输入格式为"起始位置,终止位置,大小"    '; '🔅集中力与均布载荷向下为正,集中力偶矩顺时针为正     '};

            % Create WaitingLampLabel
            app.WaitingLampLabel = uilabel(app.ControlInputPanel);
            app.WaitingLampLabel.HorizontalAlignment = 'center';
            app.WaitingLampLabel.FontName = '3ds Light';
            app.WaitingLampLabel.FontSize = 13;
            app.WaitingLampLabel.FontWeight = 'bold';
            app.WaitingLampLabel.FontColor = [0.651 0.2196 0.4];
            app.WaitingLampLabel.Position = [303 586 50 22];
            app.WaitingLampLabel.Text = 'Waiting';

            % Create WaitingLamp
            app.WaitingLamp = uilamp(app.ControlInputPanel);
            app.WaitingLamp.Position = [365 586 20 20];
            app.WaitingLamp.Color = [0.2 0.4392 0.6784];

            % Create Button_Reset
            app.Button_Reset = uibutton(app.ControlInputPanel, 'push');
            app.Button_Reset.ButtonPushedFcn = createCallbackFcn(app, @Button_ResetPushed, true);
            app.Button_Reset.Tag = 'Button_Clean';
            app.Button_Reset.FontName = '3ds Light';
            app.Button_Reset.FontSize = 15;
            app.Button_Reset.FontWeight = 'bold';
            app.Button_Reset.FontColor = [0.651 0.2196 0.4];
            app.Button_Reset.Position = [215 155 72 27];
            app.Button_Reset.Text = 'Reset';

            % Create PlotLabel
            app.PlotLabel = uilabel(app.UIFigure);
            app.PlotLabel.HorizontalAlignment = 'center';
            app.PlotLabel.FontName = '3ds Light';
            app.PlotLabel.FontSize = 15;
            app.PlotLabel.FontWeight = 'bold';
            app.PlotLabel.FontColor = [0.0627 0.5451 0.5882];
            app.PlotLabel.Position = [1 627 72 26];
            app.PlotLabel.Text = 'Plot';

            % Create KeyPointsLabel
            app.KeyPointsLabel = uilabel(app.UIFigure);
            app.KeyPointsLabel.HorizontalAlignment = 'center';
            app.KeyPointsLabel.FontName = '3ds Light';
            app.KeyPointsLabel.FontSize = 15;
            app.KeyPointsLabel.FontWeight = 'bold';
            app.KeyPointsLabel.FontColor = [0.0627 0.5451 0.5882];
            app.KeyPointsLabel.Position = [392 291 76 26];
            app.KeyPointsLabel.Text = 'Key Points';

            % Create NLabel
            app.NLabel = uilabel(app.UIFigure);
            app.NLabel.Tag = 'Edit_Input';
            app.NLabel.FontName = '3ds Light';
            app.NLabel.FontSize = 13;
            app.NLabel.FontColor = [0.4706 0.5882 0.2902];
            app.NLabel.Position = [394 263 122 30];
            app.NLabel.Text = '剪力最大值(N):';

            % Create NLabel_2
            app.NLabel_2 = uilabel(app.UIFigure);
            app.NLabel_2.Tag = 'Edit_Input';
            app.NLabel_2.FontName = '3ds Light';
            app.NLabel_2.FontSize = 13;
            app.NLabel_2.FontColor = [0.4706 0.5882 0.2902];
            app.NLabel_2.Position = [394 216 122 30];
            app.NLabel_2.Text = '剪力最小值(N):';

            % Create NmLabel
            app.NmLabel = uilabel(app.UIFigure);
            app.NmLabel.FontName = '黑体';
            app.NmLabel.FontSize = 13;
            app.NmLabel.FontColor = [0.4706 0.5882 0.2902];
            app.NmLabel.Position = [394 169 122 30];
            app.NmLabel.Text = '弯矩最大值(N·m):';

            % Create NmLabel_2
            app.NmLabel_2 = uilabel(app.UIFigure);
            app.NmLabel_2.FontName = '黑体';
            app.NmLabel_2.FontSize = 13;
            app.NmLabel_2.FontColor = [0.4667 0.5882 0.2863];
            app.NmLabel_2.Position = [394 122 122 30];
            app.NmLabel_2.Text = '弯矩最小值(N·m):';

            % Create mLabel
            app.mLabel = uilabel(app.UIFigure);
            app.mLabel.FontName = '黑体';
            app.mLabel.FontSize = 13;
            app.mLabel.FontColor = [0.4667 0.5882 0.2863];
            app.mLabel.Position = [394 29 122 30];
            app.mLabel.Text = '挠度最大值(m):';

            % Create mLabel_2
            app.mLabel_2 = uilabel(app.UIFigure);
            app.mLabel_2.Tag = 'Edit_Input';
            app.mLabel_2.FontName = '3ds Light';
            app.mLabel_2.FontSize = 13;
            app.mLabel_2.FontColor = [0.349 0.4588 0.7294];
            app.mLabel_2.Position = [632 263 64 30];
            app.mLabel_2.Text = '位置(m):';

            % Create mLabel_3
            app.mLabel_3 = uilabel(app.UIFigure);
            app.mLabel_3.Tag = 'Edit_Input';
            app.mLabel_3.FontName = '3ds Light';
            app.mLabel_3.FontSize = 13;
            app.mLabel_3.FontColor = [0.349 0.4588 0.7294];
            app.mLabel_3.Position = [632 216 64 30];
            app.mLabel_3.Text = '位置(m):';

            % Create mLabel_4
            app.mLabel_4 = uilabel(app.UIFigure);
            app.mLabel_4.FontName = '黑体';
            app.mLabel_4.FontSize = 13;
            app.mLabel_4.FontColor = [0.349 0.4588 0.7294];
            app.mLabel_4.Position = [632 169 60 30];
            app.mLabel_4.Text = '位置(m):';

            % Create mLabel_5
            app.mLabel_5 = uilabel(app.UIFigure);
            app.mLabel_5.FontName = '黑体';
            app.mLabel_5.FontSize = 13;
            app.mLabel_5.FontColor = [0.349 0.4588 0.7294];
            app.mLabel_5.Position = [632 122 60 30];
            app.mLabel_5.Text = '位置(m):';

            % Create mLabel_6
            app.mLabel_6 = uilabel(app.UIFigure);
            app.mLabel_6.FontName = '黑体';
            app.mLabel_6.FontSize = 13;
            app.mLabel_6.FontColor = [0.349 0.4627 0.7294];
            app.mLabel_6.Position = [632 29 60 30];
            app.mLabel_6.Text = '位置(m):';

            % Create Force_Max
            app.Force_Max = uieditfield(app.UIFigure, 'numeric');
            app.Force_Max.Tag = 'Edit_Input';
            app.Force_Max.Editable = 'off';
            app.Force_Max.HorizontalAlignment = 'center';
            app.Force_Max.FontName = '3ds Light';
            app.Force_Max.FontSize = 13;
            app.Force_Max.FontWeight = 'bold';
            app.Force_Max.FontColor = [0.0706 0.3098 0.4784];
            app.Force_Max.Position = [524 267 100 23];

            % Create Force_Min
            app.Force_Min = uieditfield(app.UIFigure, 'numeric');
            app.Force_Min.Tag = 'Edit_Input';
            app.Force_Min.Editable = 'off';
            app.Force_Min.HorizontalAlignment = 'center';
            app.Force_Min.FontName = '3ds Light';
            app.Force_Min.FontSize = 13;
            app.Force_Min.FontWeight = 'bold';
            app.Force_Min.FontColor = [0.0706 0.3098 0.4784];
            app.Force_Min.Position = [524 220 100 23];

            % Create Torque_Max
            app.Torque_Max = uieditfield(app.UIFigure, 'numeric');
            app.Torque_Max.Tag = 'Torque_Max';
            app.Torque_Max.Editable = 'off';
            app.Torque_Max.HorizontalAlignment = 'center';
            app.Torque_Max.FontName = '3ds Light';
            app.Torque_Max.FontSize = 13;
            app.Torque_Max.FontWeight = 'bold';
            app.Torque_Max.FontColor = [0.0706 0.3098 0.4784];
            app.Torque_Max.Position = [524 173 100 23];

            % Create Torque_Min
            app.Torque_Min = uieditfield(app.UIFigure, 'numeric');
            app.Torque_Min.Tag = 'Torque_Min';
            app.Torque_Min.Editable = 'off';
            app.Torque_Min.HorizontalAlignment = 'center';
            app.Torque_Min.FontName = '3ds Light';
            app.Torque_Min.FontSize = 13;
            app.Torque_Min.FontWeight = 'bold';
            app.Torque_Min.FontColor = [0.0706 0.3098 0.4784];
            app.Torque_Min.Position = [524 126 100 23];

            % Create Deflection_Max
            app.Deflection_Max = uieditfield(app.UIFigure, 'numeric');
            app.Deflection_Max.Tag = 'Deflection_Max';
            app.Deflection_Max.Editable = 'off';
            app.Deflection_Max.HorizontalAlignment = 'center';
            app.Deflection_Max.FontName = '3ds Light';
            app.Deflection_Max.FontSize = 13;
            app.Deflection_Max.FontWeight = 'bold';
            app.Deflection_Max.FontColor = [0.0706 0.3137 0.4824];
            app.Deflection_Max.Position = [524 33 100 23];

            % Create F_Max_Position
            app.F_Max_Position = uieditfield(app.UIFigure, 'numeric');
            app.F_Max_Position.Tag = 'Edit_Input';
            app.F_Max_Position.Editable = 'off';
            app.F_Max_Position.HorizontalAlignment = 'center';
            app.F_Max_Position.FontName = '3ds Light';
            app.F_Max_Position.FontSize = 13;
            app.F_Max_Position.FontWeight = 'bold';
            app.F_Max_Position.FontColor = [0.0706 0.3098 0.4784];
            app.F_Max_Position.Position = [700 267 60 23];

            % Create F_Min_Position
            app.F_Min_Position = uieditfield(app.UIFigure, 'numeric');
            app.F_Min_Position.Tag = 'Edit_Input';
            app.F_Min_Position.Editable = 'off';
            app.F_Min_Position.HorizontalAlignment = 'center';
            app.F_Min_Position.FontName = '3ds Light';
            app.F_Min_Position.FontSize = 13;
            app.F_Min_Position.FontWeight = 'bold';
            app.F_Min_Position.FontColor = [0.0706 0.3098 0.4784];
            app.F_Min_Position.Position = [700 220 60 23];

            % Create T_Max_Position
            app.T_Max_Position = uieditfield(app.UIFigure, 'numeric');
            app.T_Max_Position.Tag = 'T_Max_Position';
            app.T_Max_Position.Editable = 'off';
            app.T_Max_Position.HorizontalAlignment = 'center';
            app.T_Max_Position.FontName = '3ds Light';
            app.T_Max_Position.FontSize = 13;
            app.T_Max_Position.FontWeight = 'bold';
            app.T_Max_Position.FontColor = [0.0706 0.3098 0.4784];
            app.T_Max_Position.Position = [700 173 60 23];

            % Create T_Min_Position
            app.T_Min_Position = uieditfield(app.UIFigure, 'numeric');
            app.T_Min_Position.Tag = 'T_Min_Position';
            app.T_Min_Position.Editable = 'off';
            app.T_Min_Position.HorizontalAlignment = 'center';
            app.T_Min_Position.FontName = '3ds Light';
            app.T_Min_Position.FontSize = 13;
            app.T_Min_Position.FontWeight = 'bold';
            app.T_Min_Position.FontColor = [0.0706 0.3137 0.4824];
            app.T_Min_Position.Position = [700 126 60 23];

            % Create Deflection_Position
            app.Deflection_Position = uieditfield(app.UIFigure, 'numeric');
            app.Deflection_Position.Tag = 'Deflection_Position';
            app.Deflection_Position.Editable = 'off';
            app.Deflection_Position.HorizontalAlignment = 'center';
            app.Deflection_Position.FontName = '3ds Light';
            app.Deflection_Position.FontSize = 13;
            app.Deflection_Position.FontWeight = 'bold';
            app.Deflection_Position.FontColor = [0.0706 0.3137 0.4824];
            app.Deflection_Position.Position = [700 33 60 23];

            % Create radLabel
            app.radLabel = uilabel(app.UIFigure);
            app.radLabel.FontName = '黑体';
            app.radLabel.FontSize = 13;
            app.radLabel.FontColor = [0.4667 0.5882 0.2863];
            app.radLabel.Position = [394 75 122 30];
            app.radLabel.Text = '转角最大值(rad):';

            % Create mLabel_8
            app.mLabel_8 = uilabel(app.UIFigure);
            app.mLabel_8.FontName = '黑体';
            app.mLabel_8.FontSize = 13;
            app.mLabel_8.FontColor = [0.349 0.4627 0.7294];
            app.mLabel_8.Position = [632 75 60 30];
            app.mLabel_8.Text = '位置(m):';

            % Create Theta_Max
            app.Theta_Max = uieditfield(app.UIFigure, 'numeric');
            app.Theta_Max.Tag = 'Theta_Max';
            app.Theta_Max.Editable = 'off';
            app.Theta_Max.HorizontalAlignment = 'center';
            app.Theta_Max.FontName = '3ds Light';
            app.Theta_Max.FontSize = 13;
            app.Theta_Max.FontWeight = 'bold';
            app.Theta_Max.FontColor = [0.0706 0.3137 0.4824];
            app.Theta_Max.Position = [524 79 100 23];

            % Create Theta_Position
            app.Theta_Position = uieditfield(app.UIFigure, 'numeric');
            app.Theta_Position.Tag = 'Theta_Pos';
            app.Theta_Position.Editable = 'off';
            app.Theta_Position.HorizontalAlignment = 'center';
            app.Theta_Position.FontName = '3ds Light';
            app.Theta_Position.FontSize = 13;
            app.Theta_Position.FontWeight = 'bold';
            app.Theta_Position.FontColor = [0.0706 0.3137 0.4824];
            app.Theta_Position.Position = [700 79 60 23];

            % Create WaitingLampLabel_2
            app.WaitingLampLabel_2 = uilabel(app.UIFigure);
            app.WaitingLampLabel_2.HorizontalAlignment = 'center';
            app.WaitingLampLabel_2.FontName = '3ds Light';
            app.WaitingLampLabel_2.FontSize = 13;
            app.WaitingLampLabel_2.FontColor = [0.651 0.2196 0.4];
            app.WaitingLampLabel_2.Position = [169 625 44 22];
            app.WaitingLampLabel_2.Text = '剪力图';

            % Create WaitingLampLabel_3
            app.WaitingLampLabel_3 = uilabel(app.UIFigure);
            app.WaitingLampLabel_3.HorizontalAlignment = 'center';
            app.WaitingLampLabel_3.FontName = '3ds Light';
            app.WaitingLampLabel_3.FontSize = 13;
            app.WaitingLampLabel_3.FontColor = [0.651 0.2196 0.4];
            app.WaitingLampLabel_3.Position = [565 625 44 22];
            app.WaitingLampLabel_3.Text = '挠曲线';

            % Create WaitingLampLabel_4
            app.WaitingLampLabel_4 = uilabel(app.UIFigure);
            app.WaitingLampLabel_4.HorizontalAlignment = 'center';
            app.WaitingLampLabel_4.FontName = '3ds Light';
            app.WaitingLampLabel_4.FontSize = 13;
            app.WaitingLampLabel_4.FontColor = [0.651 0.2196 0.4];
            app.WaitingLampLabel_4.Position = [169 304 44 22];
            app.WaitingLampLabel_4.Text = '弯矩图';

            % Create WaitingLampLabel_5
            app.WaitingLampLabel_5 = uilabel(app.UIFigure);
            app.WaitingLampLabel_5.HorizontalAlignment = 'center';
            app.WaitingLampLabel_5.FontName = '3ds Light';
            app.WaitingLampLabel_5.FontSize = 13;
            app.WaitingLampLabel_5.FontWeight = 'bold';
            app.WaitingLampLabel_5.FontColor = [0.651 0.2196 0.4];
            app.WaitingLampLabel_5.Position = [343 317 29 22];
            app.WaitingLampLabel_5.Text = 'x/m';

            % Create WaitingLampLabel_6
            app.WaitingLampLabel_6 = uilabel(app.UIFigure);
            app.WaitingLampLabel_6.HorizontalAlignment = 'center';
            app.WaitingLampLabel_6.FontName = '3ds Light';
            app.WaitingLampLabel_6.FontSize = 13;
            app.WaitingLampLabel_6.FontWeight = 'bold';
            app.WaitingLampLabel_6.FontColor = [0.651 0.2196 0.4];
            app.WaitingLampLabel_6.Position = [731 313 29 22];
            app.WaitingLampLabel_6.Text = 'x/m';

            % Create WaitingLampLabel_7
            app.WaitingLampLabel_7 = uilabel(app.UIFigure);
            app.WaitingLampLabel_7.HorizontalAlignment = 'center';
            app.WaitingLampLabel_7.FontName = '3ds Light';
            app.WaitingLampLabel_7.FontSize = 13;
            app.WaitingLampLabel_7.FontWeight = 'bold';
            app.WaitingLampLabel_7.FontColor = [0.651 0.2196 0.4];
            app.WaitingLampLabel_7.Position = [343 3 29 22];
            app.WaitingLampLabel_7.Text = 'x/m';

            % Create WaitingLampLabel_8
            app.WaitingLampLabel_8 = uilabel(app.UIFigure);
            app.WaitingLampLabel_8.HorizontalAlignment = 'center';
            app.WaitingLampLabel_8.FontName = '3ds Light';
            app.WaitingLampLabel_8.FontSize = 13;
            app.WaitingLampLabel_8.FontWeight = 'bold';
            app.WaitingLampLabel_8.FontColor = [0.651 0.2196 0.4];
            app.WaitingLampLabel_8.Position = [374 604 30 22];
            app.WaitingLampLabel_8.Text = 'y/m';

            % Create WaitingLampLabel_9
            app.WaitingLampLabel_9 = uilabel(app.UIFigure);
            app.WaitingLampLabel_9.HorizontalAlignment = 'center';
            app.WaitingLampLabel_9.FontName = '3ds Light';
            app.WaitingLampLabel_9.FontSize = 13;
            app.WaitingLampLabel_9.FontWeight = 'bold';
            app.WaitingLampLabel_9.FontColor = [0.651 0.2196 0.4];
            app.WaitingLampLabel_9.Position = [2 604 28 22];
            app.WaitingLampLabel_9.Text = 'F/N';

            % Create WaitingLampLabel_10
            app.WaitingLampLabel_10 = uilabel(app.UIFigure);
            app.WaitingLampLabel_10.HorizontalAlignment = 'center';
            app.WaitingLampLabel_10.FontName = '3ds Light';
            app.WaitingLampLabel_10.FontSize = 13;
            app.WaitingLampLabel_10.FontWeight = 'bold';
            app.WaitingLampLabel_10.FontColor = [0.651 0.2196 0.4];
            app.WaitingLampLabel_10.Position = [1 261 30 35];
            app.WaitingLampLabel_10.Text = {'M/'; 'N·m'};

            % Create Label_10
            app.Label_10 = uilabel(app.UIFigure);
            app.Label_10.HorizontalAlignment = 'right';
            app.Label_10.FontName = '3ds Light';
            app.Label_10.FontColor = [0.502 0.502 0.502];
            app.Label_10.Position = [394 1 366 25];
            app.Label_10.Text = ' ';

            % Show the figure after all components are created
            app.UIFigure.Visible = 'on';
        end
    end

    % App creation and deletion
    methods (Access = public)

        % Construct app
        function app = Girder_Printer_exported

            % Create UIFigure and components
            createComponents(app)

            % Register the app with App Designer
            registerApp(app, app.UIFigure)

            if nargout == 0
                clear app
            end
        end

        % Code that executes before app deletion
        function delete(app)

            % Delete UIFigure when app is deleted
            delete(app.UIFigure)
        end
    end
end
  • 12
    点赞
  • 42
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
材料力学剪力弯矩绘制程序-untitled.fig 说明: 输入变量 分段数组x 分段点一般在集中力,集中力偶作用出和分布载荷的起末端。 载荷数组MPQ 若上的外载荷总数为PN,则用PN行四列的数组MPQ储存载荷,数组MPQ第一列代表载荷的类型:1为集中力偶,2为集中力,3为分布载荷,第二列代表载荷的大小,第三列代表集中力,集中力偶或者分布载荷左端与简支梁左端的距离,第四列代表均匀载荷右端与简支梁左端的距离,当载荷为集中力或者集中力偶时,第四列为0. 符号规定 集中力和均匀载荷向下为正,向上为负,集中力偶顺时针为正,逆时针为负。 输出变量 内力数组XQM 如果被分为NN-1段,则内力数组XQM为NN行,三列的数组,第一列代表的横截面的位置,第二列代表剪力,第三列代表弯矩剪力极值及位置QDX QDX是一个二行二列的数组,第一列代表极值所在的位置,第二列代表极值 弯矩极值及位置MDX MDX是一个二行二列的数组,第一列代表极值所在的位置,第二列代表极值 子程序 集中力偶对弯矩贡献的子函数QMM 集中力对剪力弯矩贡献的子函数QMP 分布载荷对剪力弯矩贡献的子函数QMQ 求剪力弯矩极值的子函数MAX_MIN 绘制剪力图和弯矩图的子函数TU_QM 计算分析程序 简支梁QMDJ 左端固定悬臂QMDXZ 右端固定悬臂QMDXY 左端外伸QMDWZ 右端外伸QMDWY 两端外伸QMDWL 所含文件: Figure82.jpg 材料力学剪力弯矩绘制程序 运行结果: Figure83.jpg 材料力学剪力弯矩绘制程序

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值