哈工大材料力学上机报告--绘制梁的剪力弯矩图

更新时间:2024-05-22 16:51:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

Harbin Institute of Technology

材料力学上机作业

课程名称: 材料力学 设计题目: 绘制梁的剪力弯矩图 院 系: 机电工程学院 班 级: 分 析 者: 学 号:

指导教师: 张桂莲 设计时间: 2014.6.3

哈尔滨工业大学

一、设计题目

题目4 绘制梁的剪力弯矩图 输入:

1.梁的总长度l

2.支撑条件及量的各区段长度输入(左、右固定端悬臂梁;简支梁;左、右、双外伸梁)

3.各载荷大小、作用位置及方向(qi、ai、bi;pj、cj、mk、dk) 输出:

1. 结构构型图(图示) 2. 剪力、弯矩(图示)

3. 输出剪力、弯矩的最大值及截面位置。

二、程序介绍 1、简介

本程序编译平台为MATLAB,能够对六种梁(左固定端悬臂梁、右固定端悬臂梁、简支梁、左外伸梁、右外伸梁、双外伸梁)在集中载荷、均布载荷及弯矩作用下的剪力、弯矩进行求解并绘制剪力、弯矩图。本程序基于MATLAB的图形用户界面(GUI)功能,操作简单、运算稳定、界面简约美观,有良好的交互性。 2、程序使用方法

此程序运行环境为安装有MATLAB R2011a或以上版本的计算机。要运行此程序,首先打开MATLAB,在其中打开“KaiShiJieMian.m”文件,在函数编辑窗口里点击运行按钮(或按F5键),程序便开始启动。启动画面如下:

图1 启动界面

点击“进入”即可进入选择梁的类型界面,在此界面中,使用者根据实际情况选择要研究的梁的类型,点击即可进入相应梁的计算界面。例如想要计算双外伸梁,则点击“6、双外伸梁”即可进入计算界面,若想返回开始界面,则点击“返回开始界面”即可。

图2 梁的选择界面

图3 梁的计算界面

此程序可以计算梁在集中力、均布力和集中力偶的作用下梁的剪力和弯矩,并求出剪力的最大值和弯矩的最大值。以双外伸梁为例,对照左侧参数输入提示,在相应文本框里输入梁的基本参数,如弹性模量E、长度L,和载荷大小及位置,如均布力q、均布力起始位置b1、结束位置b2。输入完毕后点击“计算”按钮,在作图框内便显示出梁的剪力和弯矩图和最大值点,在结果文本框内便得出相应最大值和最大值所在位置。若要改变参数,先点击“清除”按钮,使做图框和结果文本框初始化,再更改相应参数,再次点击“计算”。

三、程序设计过程

以左固定端悬臂梁为例,首先选取坐标系,确定载荷大小、类型和位置坐标,然后分别计算单个载荷所对应的支反力和力矩,用公式计算位置x处对应的剪力和弯矩值,最后把各个载荷产生的在位置x处的剪力和弯矩值相加,便得出总的

剪力和弯矩值。要注意的是,集中力和均布力取向下为正,外力偶取逆时针为正。所用公式如下:

图4 左固定端悬臂梁计算示意图

设F产生的支反力为FOy1,力偶为MO1,对应的剪力为Fsx1,弯矩为Mx1;q产生的支反力为FOy2,力偶为MO2,对应的剪力为Fsx2,弯矩为Mx2;M产生的支反力为FOy3,力偶为MO3,对应的剪力为Fsx3,弯矩为Mx3。则: FOy1=F;

MO1=FOy1*a; FOy2=q*(b2-b1);

MO2=q*(b2-b1)*(b2+b1)/2; FOy3=0; MO3=M; 对于F:

当x<=a时, Fsx1=-FOy1;

Mx1=FOy1*x-MO1; 当a

当x<=b1时 Fsx2=-FOy2;

Mx2=FOy2*x-MO2; 当b1

Fsx2=-FOy2 + q*(x-b1);

Mx2(ff)=FOy2*x-MO2-(x-b1)^2*q/2; 当b2

Mx2=0; 对于M:

当x<=c时 Fsx3=0; Mx3=M; 当c

最后,设合剪力为Fsx,合弯矩为Mx,则: Fsx=Fsx1+Fsx2+Fsx3; Mx=Mx1+Mx2+Mx3;

对应程序如下所示:

E=10^9*str2double(get(handles.edit1,'String')); L=str2double(get(handles.edit2,'String')); F=str2double(get(handles.edit3,'String')); a=str2double(get(handles.edit4,'String')); q=str2double(get(handles.edit5,'String')); b1=str2double(get(handles.edit6,'String')); b2=str2double(get(handles.edit7,'String')); M=str2double(get(handles.edit8,'String')); c=str2double(get(handles.edit9,'String')); x=[0:L/500:L]; FOy1=F; MO1=FOy1*a; FOy2=q*(b2-b1);

MO2=q*(b2-b1)*(b2+b1)/2; FOy3=0; MO3=M;

leng=length(x); xx1=round(a/L*leng); xx21=round(b1/L*leng); xx22=round(b2/L*leng); xx3=round(c/L*leng); for ii=1:leng if ii<=xx1 Fsx1(ii)=-FOy1;

Mx1(ii)=FOy1*(ii-1)*L/500-MO1; else

Fsx1(ii)=0; Mx1(ii)=0; end end

for ff=1:leng

if ff<=xx21 Fsx2(ff)=-FOy2;

Mx2(ff)=FOy2*(ff-1)*L/500-MO2; else

if ff<=xx22

Fsx2(ff)=-FOy2 + q*((ff-1)*L/500-b1);

Mx2(ff)=FOy2*(ff-1)*L/500-MO2-((ff-1)*L/500-b1)^2*q/2; else

Fsx2(ff)=0; Mx2(ff)=0; end end end

for pp=1:leng if pp<=xx3; Fsx3(pp)=0; Mx3(pp)=M; else

Fsx3(pp)=0; Mx3(pp)=0; end end flag1=1; flag2=1;

Fsx=Fsx3+Fsx2+Fsx1; Mx=Mx3+Mx2+Mx1; for jj=1:leng

if abs(Fsx(jj))>=abs(Fsx(flag1)) flag1=jj; end

if abs(Mx(jj))>=abs(Mx(flag2)) flag2=jj; end end yy=0*ones(1,leng); yyy2=abs(Fsx); yyyy2=max(yyy2); yyy3=abs(Mx); yyyy3=max(yyy3); axes(handles.axes2); grid on

plot(x,yy,'LineWidth',2); axis([0,L,-2*yyyy2,2*yyyy2]); hold on

plot(x,Fsx,'LineWidth',2); hold on

xxx1=L/500*(flag1-1);

plot(xxx1,Fsx(flag1),'bo','MarkerSize',10); hold on

for kk=1:4:leng

plot([x(kk),x(kk)],[0,Fsx(kk)],'LineWidth',0.4) end

xlabel('x/m'); ylabel('??á|Fs/N'); axes(handles.axes3); grid on

plot(x,yy,'LineWidth',2);

axis([0,L,-1.2*yyyy3,1.2*yyyy3]); hold on

plot(x,Mx,'LineWidth',2); hold on

xxx2=L/500*(flag2-1);

plot(xxx2,Mx(flag2),'bo','MarkerSize',10); for ll=1:4:leng

plot([x(ll),x(ll)],[0,Mx(ll)],'LineWidth',0.4) end

str1=num2str(yyyy2); str2=num2str(xxx1);

set(handles.edit10,'String',str1); set(handles.edit11,'String',str2); str3=num2str(yyyy3); str4=num2str(xxx2);

set(handles.edit12,'String',str3); set(handles.edit13,'String',str4);

从程序文本框中输入参数值,输入完毕后点击“计算”按钮,在作图框内便显示出梁的剪力和弯矩图和最大值点,在结果文本框内便得出相应最大值和最大值所在位置。

其他梁的程序设计过程也如此,这里不再叙述

四、程序算例

下面给出各个梁的算例。 1、左固定端悬臂梁计算例题

例1.有一左固定端悬臂梁长l=4m,在梁中间作用有集中力P=4N,梁右端作用有集中力偶m=5N·m,左端作用均布载荷,载荷集度q=2N/m,作用图示如下。请作出梁的剪力弯矩图,并求出剪力弯矩的最大值与其出现位置。

计算结果:

图5 计算结果截图

根据题意可得FA=8N,MB=7N·m,将梁分为AC、BC段进行分析,即可作出梁的剪力、弯矩图,所作图形与程序所作结果相同。从剪力、弯矩图上显然可以看出剪力最大值Fmax=8N,弯矩最大值Mz=7N·m,均与程序相同,故此段程序编写正确。

2、右固定端悬臂梁计算例题

例2.有一右固定端悬臂梁长l=2m,在梁中间作用有集中力F=5N,梁右端作用竖直向下的集中力P,大小为5N,在梁的0.5m到1.5m作用有均布载荷,载荷集度为q=2N/m,梁左端作用有顺时针集中力偶m=10N·m,作用图示如下。请作出梁的剪力弯矩图,并求出剪力弯矩的最大值与其出现位置。

计算结果:

根据题意可得FB=7N,MA=5N·m,将梁分为AD、DC、CE、EB段进行分析即可作出梁的剪力弯矩图,所作图形与程序结果相同。从剪力、弯矩图上显然可以

看出剪力最大值Fmax=7N(出现在EB段,本段程序显示结果在E截面处),弯矩最大值Mz=5N·m(出现在AD段,本段程序显示结果在A截面处),均与程序相同,故此段程序编写正确。

图6 计算结果截图

3、简支梁计算例题

例3. 已知一横梁长l=4m,两端铰支。现在x=2m处作用一大小为4N、方向竖直向下的集中力,并且在整根梁上作用有竖直向下的均布载荷,大小为q=2N/m,作用示意图如下。试做出梁上的剪力和弯矩图,并求出剪力弯矩的最大、最小值及它们出现的位置。

计算结果:

求支反力得FA=6N,FB=6N,作梁的剪力弯矩图与程序所作结果相同,从剪力弯矩图上显然可以得到剪力最大值Fmax=6N,弯矩最大值Mz=8N·m,与程序相同。理论计算绘制图示上可以看出剪力最大值在梁的左右两端点处取到(x=0和x=4m处),程序中只显示了一个(x=4m处)。

图7 计算结果截图

4、左外伸梁计算例题

例4. 已知一左外伸梁长3m,可动铰支座距左端面1m,在x=2m处作用一大小为P=10N,方向竖直向下的集中力,图形如下。试做出梁上的剪力和弯矩图,并求出剪力弯矩的最大、最小值及它们出现的位置。

计算结果:

图8 计算结果截图

求支反力得FA=2.5N FB=7.5N,作梁的剪力弯矩图与程序所作结果基本相

同(程序所作剪力弯矩图中有断点存在,这是由于本程序绘制剪力弯矩图采用的是散点法,当剪力弯矩值有突变时程序计算的因数值不连续而产生“跳跃”现象),从剪力弯矩图上显然可以得到剪力最大值Fmax=7.5N,弯矩最大值Mz=7.5N·m,与程序相同。

5、右外伸梁计算例题

例5. 已知一右外伸梁长1.5米,右支点距右端面0.5米,在两支架中间作用一大小为P=5N,方向竖直向上的集中力,图形如下,试做出梁上的剪力和弯矩图,并求出剪力弯矩的最大、最小值及它们出现的位置。

计算结果:

图9 计算结果截图

求支反力得FA=2.5N FB=2.5N,作梁的剪力弯矩图与程序所作结果相同(程序所作剪力弯矩图中有断点存在,这是由于本程序绘制剪力弯矩图采用的是散点法,当剪力弯矩值有突变时程序计算的因数值不连续而产生“跳跃”现象),从剪力弯矩图上显然可以得到剪力最大值Fmax=2.5N,弯矩最大值Mz=1.25N·m,与程序计算结果相同。理论计算绘制图示上可以看出剪力和弯矩最大值应该在x=0.5m处取到,而程序计算的最大值分别在x=0.999m和x=0.501m取到,这是由于在程序编写过程中把梁在集中作用出分成了两段,集中力作用以左部分所有的x都小于0.5m,集中力作用以右部分所有x都大于0.5m,因而显示结果会出现与理论计算的微小差别。

6、双外伸梁计算例题

例6. 已知一双外伸梁长4米,固定铰支座距左端面1m,可动铰支座距右端面1m,在距离梁的左端0.5m处作用一大小为F=4N、方向竖直向下的集中力,两铰支座之间作用有向下的均布载荷,大小为2N/m,图形如下。试做出梁上的剪力和弯矩图,并求出剪力弯矩的最大、最小值及它们出现的位置。

计算结果:

求支反力得FA=1N FB=7N,作梁的剪力弯矩图与程序所作结果相同(程序所作剪力图中有断点存在,这是由于本程序绘制剪力弯矩图采用的是散点法,当剪力弯矩值有突变时程序计算的因数值不连续而产生“跳跃”现象),从剪力弯矩图上显然可以得到剪力最大值Fmax=4N,弯矩最大值Mz=-2N·m,与程序计算结果相同。理论计算绘制图示上可以看出剪力和弯矩最大值分别在x=0.5mx=1m处取得,与程序计算结果也相同,因而此段程序运行正确。

图10 计算结果截图

五、程序缺陷

由于本程序绘制剪力弯矩图采用的是散点法,因而在剪力或弯矩有突变时图示上会产生断点,未连接上。可以采用“line”指令,在数据有突变时直接直线连接。

六、体会与收获

在这次上机编程作业中,我虽然花费了很长时间,但是收获很多。在此过程中,我对MATLAB语言有了更加熟悉的运用,这将成为我一生的财富,MATLAB也必将成为我日后学习工作的强大工具。在看到自己做出的最终结果以及它运行时的高效、简洁,我不禁有了一丝成就感。我为能有一次这样锻炼的机会而感到幸

运,希望以后还会更多这样的机会充实自己。对于材料力学这门课程,我想也会因为这次程序的编写而记忆的更加深刻,我一定要争取多掌握一些这方面的知识,然后在工作中充分的应用进去!

当然,作为初学者,制作出的软件不免瑕疵很多,还烦请老师批评指正。但我相信,在今后的学习中,我对MATLAB的应用能力会愈加娴熟。

七、程序源代码

1.左悬臂梁的源程序

E=getappdata(BianXing_ZuoGuDingDuan,'E');

L=getappdata(BianXing_ZuoGuDingDuan,'L');

F=getappdata(BianXing_ZuoGuDingDuan,'F');

a=getappdata(BianXing_ZuoGuDingDuan,'a');

q=getappdata(BianXing_ZuoGuDingDuan,'q');

b1=getappdata(BianXing_ZuoGuDingDuan,'b1');

b2=getappdata(BianXing_ZuoGuDingDuan,'b2');

M=getappdata(BianXing_ZuoGuDingDuan,'M');

c=getappdata(BianXing_ZuoGuDingDuan,'c');

dyuan=str2double(get(handles.edit1,'String'));

Dyuanhuan=str2double(get(handles.edit2,'String'));

dyuanhuan=str2double(get(handles.edit3,'String'));

hjuxing=str2double(get(handles.edit4,'String'));

bjuxing=str2double(get(handles.edit5,'String'));

Izgongzixing=str2double(get(handles.edit6,'String'));

Iz1=pi*dyuan^4/64; Iz2=pi*(Dyuanhuan^4-dyuanhuan^4)/64;

Iz3=bjuxing*hjuxing^3/12; Iz4=Izgongzixing; Iz=Iz1+Iz2+Iz3+Iz4; x=[0:L/500:L]; leng=length(x);

xx1=round(a/L*leng); xx21=round(b1/L*leng); xx22=round(b2/L*leng); xx3=round(c/L*leng); for ii=1:leng if ii<=xx1

vx1(ii)=-F*((ii-1)*L/500)^2*(3*a-(ii-1)*L/500)/(6*E*Iz);

else

vx1(ii)=-F*a^2*(3*(ii-1)*L/500-a)/(6*E*Iz);

end end flag1=1; vx=vx1;

handles.vx=vx; handles=surfplot(handles); guidata(hObject, handles); for jj=1:leng

if abs(vx(jj))>=abs(vx(flag1)) flag1=jj; end

end yy=0*ones(1,leng); yyy2=abs(vx); yyyy2=max(yyy2); axes(handles.axes5); grid on

plot(x,yy,'LineWidth',2);

axis([0,L,-2*yyyy2,2*yyyy2]); hold on

plot(x,100000*vx,'LineWidth',2); hold on

xxx1=L/500*(flag1-1);

plot(xxx1,vx(flag1),'bo','MarkerSize',

10);

hold on

for kk=1:4:leng

plot([x(kk),x(kk)],[0,vx(kk)],'LineWidth',0.4)

end

xlabel('x/m');

ylabel('??á|Fs/N'); 2.右悬臂梁的源程序

E=10^9*str2double(get(handles.edit1,'String'));

L=str2double(get(handles.edit2,'String'));

F=str2double(get(handles.edit3,'String'));

a=str2double(get(handles.edit4,'String'));

q=str2double(get(handles.edit5,'String'));

b1=str2double(get(handles.edit6,'String'));

b2=str2double(get(handles.edit7,'String'));

M=str2double(get(handles.edit8,'String'));

c=str2double(get(handles.edit9,'String'));

x=[0:L/500:L]; FOy1=F;

MO1=FOy1*a; FOy2=q*(b2-b1);

MO2=q*(b2-b1)*(b2+b1)/2; FOy3=0; MO3=M;

leng=length(x);

xx1=round(a/L*leng); xx21=round(b1/L*leng); xx22=round(b2/L*leng); xx3=round(c/L*leng); for ii=1:leng if ii<=xx1

Fsx1(ii)=-FOy1; Mx1(ii)=FOy1*(ii-1)*L/500-MO1;

else

Fsx1(ii)=0; Mx1(ii)=0; end end

for ff=1:leng if ff<=xx21

Fsx2(ff)=-FOy2;

Mx2(ff)=FOy2*(ff-1)*L/500-MO2;

else

if ff<=xx22

Fsx2(ff)=-FOy2 + q*((ff-1)*L/500-b1);

Mx2(ff)=FOy2*(ff-1)*L/500-MO2-((ff-1)*L/500-b1)^2*q/2;

else

Fsx2(ff)=0; Mx2(ff)=0; end end end

for pp=1:leng if pp<=xx3;

Fsx3(pp)=0; Mx3(pp)=M; else

Fsx3(pp)=0; Mx3(pp)=0; end end flag1=1; flag2=1;

Fsx=Fsx3+Fsx2+Fsx1; Mx=Mx3+Mx2+Mx1; for jj=1:leng

if abs(Fsx(jj))>=abs(Fsx(flag1)) flag1=jj; end

if abs(Mx(jj))>=abs(Mx(flag2)) flag2=jj; end

end yy=0*ones(1,leng); yyy2=abs(Fsx); yyyy2=max(yyy2); yyy3=abs(Mx); yyyy3=max(yyy3); axes(handles.axes2); grid on

plot(x,yy,'LineWidth',2);

axis([0,L,-2*yyyy2,2*yyyy2]); hold on

plot(x,Fsx,'LineWidth',2); hold on

xxx1=L/500*(flag1-1);

plot(xxx1,Fsx(flag1),'bo','MarkerSize',10);

hold on

for kk=1:4:leng

plot([x(kk),x(kk)],[0,Fsx(kk)],'LineWidth',0.4)

end

xlabel('x/m');

ylabel('??á|Fs/N'); axes(handles.axes3); grid on

plot(x,yy,'LineWidth',2);

axis([0,L,-1.2*yyyy3,1.2*yyyy3]); hold on

plot(x,Mx,'LineWidth',2); hold on

xxx2=L/500*(flag2-1);

plot(xxx2,Mx(flag2),'bo','MarkerSize',10);

for ll=1:4:leng

plot([x(ll),x(ll)],[0,Mx(ll)],'LineWidth',0.4)

end

xlabel('x/m'); ylabel('í???M/N.m'); str1=num2str(yyyy2); str2=num2str(xxx1);

set(handles.edit10,'String',str1); set(handles.edit11,'String',str2); str3=num2str(yyyy3); str4=num2str(xxx2);

set(handles.edit12,'String',str3); set(handles.edit13,'String',str4); % --- Executes on button press in togglebutton2.

function

togglebutton2_Callback(hObject, eventdata, handles)

% hObject handle to togglebutton2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

close(gcf) a=gcf;

XuanZeLiangDeLeiXing

% Hint: get(hObject,'Value') returns toggle state of togglebutton2

% --- Executes on button press in togglebutton3.

function

togglebutton3_Callback(hObject, eventdata, handles)

% hObject handle to togglebutton3 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

a=gcf;

BianXing_ZuoGuDingDuan

E=10^9*str2double(get(handles.edit1,'String'));

L=str2double(get(handles.edit2,'String'));

F=str2double(get(handles.edit3,'String'));

a=str2double(get(handles.edit4,'String'));

q=str2double(get(handles.edit5,'String'));

b1=str2double(get(handles.edit6,'St

ring'));

b2=str2double(get(handles.edit7,'String'));

M=str2double(get(handles.edit8,'String'));

c=str2double(get(handles.edit9,'String'));

setappdata(BianXing_ZuoGuDingDuan,'E',E);

setappdata(BianXing_ZuoGuDingDuan,'L',L);

setappdata(BianXing_ZuoGuDingDuan,'F',F);

setappdata(BianXing_ZuoGuDingDuan,'a',a);

setappdata(BianXing_ZuoGuDingDuan,'q',q);

setappdata(BianXing_ZuoGuDingDuan,'b1',b1);

setappdata(BianXing_ZuoGuDingDuan,'b2',b2);

setappdata(BianXing_ZuoGuDingDuan,'M',M);

setappdata(BianXing_ZuoGuDingDuan,'c',c);

% Hint: get(hObject,'Value') returns toggle state of togglebutton3

% --- Executes on button press in togglebutton5.

function

togglebutton5_Callback(hObject, eventdata, handles)

% hObject handle to togglebutton5 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

axes(handles.axes2); cla;

axes(handles.axes3); cla;

str1=num2str(0); str2=num2str(0); set(handles.edit10,'String',str1); set(handles.edit11,'String',str2); str3=num2str(0); str4=num2str(0);

set(handles.edit12,'String',str3); set(handles.edit13,'String',str4); 3.简支梁的源程序

E=10^9*str2double(get(handles.edit1,'String'));

L=str2double(get(handles.edit2,'String'));

F=str2double(get(handles.edit3,'String'));

a=str2double(get(handles.edit4,'String'));

q=str2double(get(handles.edit5,'String'));

b1=str2double(get(handles.edit6,'String'));

b2=str2double(get(handles.edit7,'String'));

M=str2double(get(handles.edit8,'String'));

c=str2double(get(handles.edit9,'String'));

x=[0:L/500:L]; FAy1=F-F*a/L; FBy1=F*a/L;

FBy2=q*(b2-b1)*(b2+b1)/(2*L); FAy2=q*(b2-b1)-FBy2; FAy3=M/L; FBy3=M/L; leng=length(x);

xx1=round(a/L*leng); xx21=round(b1/L*leng); xx22=round(b2/L*leng); xx3=round(c/L*leng); for ii=1:leng if ii<=xx1

Fsx1(ii)=-FAy1;

Mx1(ii)=FAy1*(ii-1)*L/500; else

Fsx1(ii)=FBy1;

Mx1(ii)=FBy1*(L-(ii-1)*L/500);

end end

for ff=1:leng if ff<=xx21

Fsx2(ff)=-FAy2;

Mx2(ff)=FAy2*(ff-1)*L/500;

else

if ff<=xx22

Fsx2(ff)=q*((ff-1)*L/500-b1)-FAy2;

Mx2(ff)=FAy2*(ff-1)*L/500-((ff-1)*L/500-b1)^2*q/2;

else

Fsx2(ff)=FBy2;

Mx2(ff)=FBy2*(L-(ff-1)*L/500);

end end end

for pp=1:leng if pp<=xx3

Fsx3(pp)=-FAy3;

Mx3(pp)=FAy3*(pp-1)*L/500;

else

Fsx3(pp)=-FBy3;

Mx3(pp)=-FBy3*(L-(pp-1)*L/500);

end end flag1=1; flag2=1;

Fsx=Fsx1+Fsx2+Fsx3; Mx=Mx1+Mx2+Mx3; for jj=1:leng

if abs(Fsx(jj))>=abs(Fsx(flag1)) flag1=jj; end

if abs(Mx(jj))>=abs(Mx(flag2)) flag2=jj; end end yy=0*ones(1,leng); yyy2=abs(Fsx); yyyy2=max(yyy2); yyy3=abs(Mx); yyyy3=max(yyy3); axes(handles.axes2); grid on

plot(x,yy,'LineWidth',2);

axis([0,L,-1.2*yyyy2,1.2*yyyy2]); hold on

plot(x,Fsx,'LineWidth',2); hold on

xxx1=L/500*(flag1-1);

plot(xxx1,Fsx(flag1),'bo','MarkerSize',10);

hold on

for kk=1:4:leng

plot([x(kk),x(kk)],[0,Fsx(kk)],'LineWidth',0.4)

end

xlabel('x/m');

ylabel('??á|Fs/N'); axes(handles.axes4); grid on

plot(x,yy,'LineWidth',2);

axis([0,L,-1.2*yyyy3,1.2*yyyy3]); hold on

plot(x,Mx,'LineWidth',2); hold on

xxx2=L/500*(flag2-1);

plot(xxx2,Mx(flag2),'bo','MarkerSize',10);

for ll=1:4:leng

plot([x(ll),x(ll)],[0,Mx(ll)],'LineWidth',0.4)

end

xlabel('x/m'); ylabel('í???M/N.m'); str1=num2str(yyyy2); str2=num2str(xxx1);

set(handles.edit10,'String',str1); set(handles.edit11,'String',str2);

str3=num2str(yyyy3); str4=num2str(xxx2);

set(handles.edit14,'String',str3); set(handles.edit15,'String',str4); 4.左外伸梁的源程序

E=10^9*str2double(get(handles.edit1,'String'));

L=str2double(get(handles.edit2,'String'));

F=str2double(get(handles.edit4,'String'));

a=-str2double(get(handles.edit5,'String'));

q=str2double(get(handles.edit6,'String'));

b1=-str2double(get(handles.edit7,'String'));

b2=-str2double(get(handles.edit8,'String'));

M=str2double(get(handles.edit9,'String'));

c=-str2double(get(handles.edit10,'String'));

d=-str2double(get(handles.edit3,'String'));

x=[0:-L/500:-L]; leng=length(x);

xx1=round(-a/L*leng); xx21=round(-b1/L*leng); xx22=round(-b2/L*leng); xx3=round(-c/L*leng); xx4=round(-d/L*leng); if -a<=-d

FBy1=F*a/d; FAy1=F-FBy1; for ii=1:leng if ii<=xx1

Fsx1(ii)=-FAy1;

Mx1(ii)=FAy1*(ii-1)*L/500;

else

if ii<=xx4

Fsx1(ii)=FBy1; Mx1(ii)=FBy1*(-d-(ii-1)*L/500);

else

Fsx1(ii)=0; Mx1(ii)=0; end end end else

FBy1=F*a/d; FAy1=FBy1-F; for ii=1:leng if ii<=xx4

Fsx1(ii)=FAy1;

Mx1(ii)=-FAy1*(ii-1)*L/500;

else

if ii<=xx1

Fsx1(ii)=-F; Mx1(ii)=-F*(-a-(ii-1)*L/500);

else

Fsx1(ii)=0; Mx1(ii)=0; end end end end

if -b2<=-d

FBy2=q*(b2-b1)*(b2+b1)/(2*(-d));

FAy2=-q*(b2-b1)-FBy2; for ff=1:leng if ff<=xx21

Fsx2(ff)=-FAy2

Mx2(ff)=FAy2*(ff-1)*L/500;

else

if ff<=xx22

Fsx2(ff)=-FAy2-q*((ff-1)*L/500+b1);

Mx2(ff)=FAy2*(ff-1)*L/500+q*((ff-1)*L/500+b1)*((ff-1)*L/500+b1)/2;

else

if ff<=xx4 else Fsx2(ff)=FBy2;

Mx2(ff)=FBy2*(-d-(ff-1)*L/500);

else

Fsx2(ff)=0; Mx2(ff)=0 end end end end else

if (-b1<=-d)&&(-b2>=-d)

FAy2=q*((d-b1)^2-(d-b2)^2)/(2*d);

FBy2=q*(b2-b1)-FAy2; for gg=1:leng if gg<=xx21

Fsx2(gg)=-FAy2;

Mx2(gg)=FAy2*(gg-1)*L/500;

else

if gg<=xx4

Fsx2(gg)=-FAy2-q*((gg-1)*L/500+b1);

Mx2(gg)=FAy2*(gg-1)*L/500+q*((gg-1)*L/500+b1)^2/2;

else

if gg<=xx22 Fsx2(gg)=q*(-b2-(gg-1)*L/500);

Mx2(gg)=q*(-b2-(gg-1)*L/500)^2/2;

else Fsx2(gg)=0;

Mx2(gg)=0;

end end end end

FBy2=q*(b2-b1)*(b2+b1)/(2*d);

FAy2=FBy2-q*(b2-b1); for pp=1:leng if pp<=xx4

Fsx2(pp)=FAy2;

Mx2(pp)=-FAy2*(pp-1)*L/500;

else

if pp<=xx21 Fsx2(pp)=-q*(b2-b1);

Mx2(pp)=FBy2*((pp-1)*L/500+d)-FAy2*(pp-1)*L/500;

else

if pp<=xx22 Fsx2(pp)=q*(-b2-(pp-1)*L/500);

Mx2(pp)=q*(-b2-(pp-1)*L/500)^2/2;

else Fsx2(pp)=0;

Mx2(pp)=0;

end end end end end end if -c<=-d

FAy3=M/(-d); FBy3=M/(-d); for jj=1:leng if jj<=xx3

Fsx3(jj)=-FAy3;

Mx3(jj)=FAy3*(jj-1)*L/500;

else

if jj<=xx4

Fsx3(jj)=-FAy3;

Mx3(jj)=FAy3*(jj-1)*L/500-M;

else

Fsx3(jj)=0; Mx3(jj)=0 end end end else

FAy3=M/(-d); FBy3=M/(-d); for jj=1:leng if jj<=xx4

Fsx3(jj)=-FAy3;

Mx3(jj)=FAy3*(jj-1)*L/500;

else

if jj<=xx3

Fsx3(jj)=0; Mx3(jj)=0; else

Fsx3(jj)=0; Mx3(jj)=0; end end end end flag1=1; flag2=1;

Fsx=Fsx1+Fsx2+Fsx3; Mx=Mx1+Mx2+Mx3; for jj=1:leng

if abs(Fsx(jj))>=abs(Fsx(flag1)) flag1=jj; end

if abs(Mx(jj))>=abs(Mx(flag2)) flag2=jj; end

end yy=0*ones(1,leng); yyy2=abs(Fsx); yyyy2=max(yyy2); yyy3=abs(Mx); yyyy3=max(yyy3); axes(handles.axes2); grid on

plot(x,yy,'LineWidth',2);

axis([-L,0,-1.2*yyyy2,1.2*yyyy2]); hold on

plot(x,Fsx,'LineWidth',2); hold on

xxx1=L/500*(flag1-1); mmm=-xxx1;

plot(mmm,Fsx(flag1),'bo','MarkerSize',10);

hold on

for kk=1:4:leng

plot([x(kk),x(kk)],[0,Fsx(kk)],'LineWidth',0.4)

end

xlabel('x/m');

ylabel('??á|Fs/N'); axes(handles.axes3); grid on

plot(x,yy,'LineWidth',2);

axis([-L,0,-1.2*yyyy3,1.2*yyyy3]); hold on

plot(x,Mx,'LineWidth',2); hold on

xxx2=L/500*(flag2-1); nnn=-xxx2;

plot(nnn,Mx(flag2),'bo','MarkerSize',10);

for ll=1:4:leng

plot([x(ll),x(ll)],[0,Mx(ll)],'LineWidth',0.4)

end

xlabel('x/m'); ylabel('í???M/N.m'); str1=num2str(yyyy2); str2=num2str(-xxx1);

set(handles.edit11,'String',str1); set(handles.edit12,'String',str2); str3=num2str(yyyy3); str4=num2str(-xxx2);

set(handles.edit13,'String',str3); set(handles.edit14,'String',str4);

% Hint: get(hObject,'Value') returns toggle state of togglebutton1

% --- Executes on button press in togglebutton2.

function

togglebutton2_Callback(hObject, eventdata, handles)

% hObject handle to togglebutton2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

axes(handles.axes2); cla;

axes(handles.axes3); cla;

str1=num2str(0); str2=num2str(0);

set(handles.edit11,'String',str1); set(handles.edit12,'String',str2); str3=num2str(0); str4=num2str(0);

set(handles.edit13,'String',str3); set(handles.edit14,'String',str4); % Hint: get(hObject,'Value') returns toggle state of togglebutton2

5.右外伸梁的源程序

E=10^9*str2double(get(handles.edit1,'String'));

L=str2double(get(handles.edit2,'String'));

F=str2double(get(handles.edit3,'String'));

a=str2double(get(handles.edit4,'String'));

q=str2double(get(handles.edit5,'String'));

b1=str2double(get(handles.edit6,'String'));

b2=str2double(get(handles.edit7,'String'));

M=str2double(get(handles.edit16,'String'));

c=str2double(get(handles.edit17,'String'));

d=str2double(get(handles.edit24,'String'));

x=[0:L/500:L]; leng=length(x);

xx1=round(a/L*leng); xx21=round(b1/L*leng); xx22=round(b2/L*leng); xx3=round(c/L*leng); xx4=round(d/L*leng); if a<=d

FBy1=F*a/d; FAy1=F-FBy1; for ii=1:leng if ii<=xx1

Fsx1(ii)=-FAy1;

Mx1(ii)=FAy1*(ii-1)*L/500;

else

if ii<=xx4

Fsx1(ii)=FBy1;

Mx1(ii)=FBy1*(d-(ii-1)*L/500);

else

Fsx1(ii)=0; Mx1(ii)=0; end end end else

FBy1=F*a/d; FAy1=FBy1-F; for ii=1:leng if ii<=xx4

Fsx1(ii)=FAy1;

Mx1(ii)=-FAy1*(ii-1)*L/500;

else

if ii<=xx1

Fsx1(ii)=-F; Mx1(ii)=-F*(a-(ii-1)*L/500);

else

Fsx1(ii)=0; Mx1(ii)=0; end end end end

if b2<=d

FBy2=q*(b2-b1)*(b2+b1)/(2*d);

FAy2=q*(b2-b1)-FBy2; for ff=1:leng if ff<=xx21

Fsx2(ff)=-FAy2

Mx2(ff)=FAy2*(ff-1)*L/500;

else

if ff<=xx22

Fsx2(ff)=-FAy2+q*((ff-1)*L/500-b1);

Mx2(ff)=FAy2*(ff-1)*L/500-q*((ff-1)*L/500-b1)*((ff-1)*L/500-b1)/2;

else

if ff<=xx4 Fsx2(ff)=FBy2;

Mx2(ff)=FBy2*(d-(ff-1)*L/500);

else

Fsx2(ff)=0; Mx2(ff)=0 end end end end else

if (b1<=d)&&(b2>=d)

FAy2=q*((d-b1)^2-(d-b2)^2)/(2*d);

FBy2=q*(b2-b1)-FAy2; for gg=1:leng if gg<=xx21 Fsx2(gg)=-FAy2;

Mx2(gg)=FAy2*(gg-1)*L/500;

else

if gg<=xx4

Fsx2(gg)=-FAy2+q*((gg-1)*L/500-b1);

Mx2(gg)=FAy2*(gg-1)*L/500-q*((gg-1)*L/500-b1)^2/2;

else

if gg<=xx22 Fsx2(gg)=-q*(b2-(gg-1)*L/500);

Mx2(gg)=-q*(b2-(gg-1)*L/500)^2/2;

else Fsx2(gg)=0;

Mx2(gg)=0;

end end end end else

FBy2=q*(b2-b1)*(b2+b1)/(2*d);

FAy2=FBy2-q*(b2-b1); for pp=1:leng if pp<=xx4

Fsx2(pp)=FAy2;

Mx2(pp)=-FAy2*(pp-1)*L/500;

else

if pp<=xx21 Fsx2(pp)=-q*(b2-b1);

Mx2(pp)=FBy2*((pp-1)*L/500-d)-FAy2*(pp-1)*L/500;

else

if pp<=xx22

Fsx2(pp)=-q*(b2-(pp-1)*L/500);

Mx2(pp)=-q*(b2-(pp-1)*L/500)^2/2;

else Fsx2(pp)=0;

Mx2(pp)=0;

end end end end end end if c<=d

FAy3=M/d; FBy3=M/d; for jj=1:leng if jj<=xx3

Fsx3(jj)=-FAy3;

Mx3(jj)=FAy3*(jj-1)*L/500;

else

if jj<=xx4

Fsx3(jj)=-FAy3;

Mx3(jj)=FAy3*(jj-1)*L/500-M;

else

Fsx3(jj)=0; Mx3(jj)=0 end end end else

FAy3=M/d; FBy3=M/d; for jj=1:leng if jj<=xx4

Fsx3(jj)=-FAy3;

Mx3(jj)=FAy3*(jj-1)*L/500;

else

if jj<=xx3

Fsx3(jj)=0; Mx3(jj)=0; else

Fsx3(jj)=0; Mx3(jj)=0; end end end end flag1=1; flag2=1;

Fsx=Fsx1+Fsx2+Fsx3; Mx=Mx1+Mx2+Mx3; for jj=1:leng

if abs(Fsx(jj))>=abs(Fsx(flag1)) flag1=jj; end

if abs(Mx(jj))>=abs(Mx(flag2)) flag2=jj; end

end yy=0*ones(1,leng); yyy2=abs(Fsx); yyyy2=max(yyy2); yyy3=abs(Mx); yyyy3=max(yyy3); axes(handles.axes2); grid on

plot(x,yy,'LineWidth',2);

axis([0,L,-1.2*yyyy2,1.2*yyyy2]); hold on

plot(x,Fsx,'LineWidth',2); hold on

xxx1=L/500*(flag1-1);

plot(xxx1,Fsx(flag1),'bo','MarkerSize',10);

hold on

for kk=1:4:leng

plot([x(kk),x(kk)],[0,Fsx(kk)],'LineWidth',0.4)

end

xlabel('x/m');

ylabel('??á|Fs/N'); axes(handles.axes4);

grid on

plot(x,yy,'LineWidth',2);

axis([0,L,-1.2*yyyy3,1.2*yyyy3]); hold on

plot(x,Mx,'LineWidth',2); hold on

xxx2=L/500*(flag2-1);

plot(xxx2,Mx(flag2),'bo','MarkerSize',10);

for ll=1:4:leng

plot([x(ll),x(ll)],[0,Mx(ll)],'LineWidth',0.4)

end

xlabel('x/m'); ylabel('í???M/N.m'); str1=num2str(yyyy2); str2=num2str(xxx1);

set(handles.edit18,'String',str1); set(handles.edit19,'String',str2); str3=num2str(yyyy3); str4=num2str(xxx2);

set(handles.edit22,'String',str3); set(handles.edit23,'String',str4); % Hint: get(hObject,'Value') returns toggle state of togglebutton1

6.双外伸梁的源程序

E=10^9*str2double(get(handles.edit1,'String'));

L=str2double(get(handles.edit2,'String'));

F=str2double(get(handles.edit4,'String'));

a=str2double(get(handles.edit5,'String'));

q=str2double(get(handles.edit6,'String'));

b1=str2double(get(handles.edit7,'String'));

b2=str2double(get(handles.edit8,'String'));

M=str2double(get(handles.edit9,'String'));

c=str2double(get(handles.edit10,'String'));

d1=str2double(get(handles.edit3,'String'));

d2=str2double(get(handles.edit15,'String'));

x=[0:L/500:L]; leng=length(x);

xx1=round(a/L*leng); xx21=round(b1/L*leng); xx22=round(b2/L*leng); xx3=round(c/L*leng); xx41=round(d1/L*leng); xx42=round(d2/L*leng); if a<=d1

FBy1=F*(d1-a)/(d2-d1); FAy1=F+FBy1; for ii=1:leng if ii<=xx1

Fsx1(ii)=0; Mx1(ii)=0; else

if ii<=xx41 Fsx1(ii)=F; Mx1(ii)=F*((ii-1)*L/500-a);

else

if ii<=xx42 Fsx1(ii)=-FBy1;

Mx1(ii)=-FBy1*(d2-(ii-1)*L/500);

else

Fsx1(ii)=0; Mx1(ii)=0; end end end end else

if a<=d2

FBy1=F*(a-d1)/(d2-d1); FAy1=F-FBy1; for ii=1:leng if ii<=xx41

Fsx1(ii)=0; Mx1(ii)=0; Fsx1(ii)=0;

else

if ii<=xx1 Fsx1(ii)=-FAy1;

Mx1(ii)=FAy1*((ii-1)*L/500-d1);

else

if ii<=xx42 Fsx1(ii)=FBy1;

Mx1(ii)=FBy1*(d2-(ii-1)*L/500);

else Fsx1(ii)=0;

Mx1(ii)=0;

end end end end else

FBy1=F*(a-d1)/(d2-d1); FAy1=FBy1-F; for ii=1:leng if ii<=xx41

Fsx1(ii)=0; Mx1(ii)=0; else

if ii<=xx42 Fsx1(ii)=FAy1;

Mx1(ii)=-FAy1*((ii-1)*L/500-d1);

else

if ii<=xx1 Fsx1(ii)=-F;

Mx1(ii)=-F*(a-(ii-1)*L/500);

else Mx1(ii)=0;

end end end end end end

if b2<=d1

FBy2=q*(b2-b1)*(d1-(b1+b2)/2)/(d2-d1);

FAy2=q*(b2-b1)+FBy2; for ii=1:leng if ii<=xx21 Fsx2(ii)=0; Mx2(ii)=0; else

if ii<=xx22 Fsx2(ii)=q*((ii-1)*L/500-b1);

Mx2(ii)=-q*((ii-1)*L/500-b1)^2/2;

else

if ii<=xx41 Fsx2(ii)=q*(b2-b1);

Mx2(ii)=-q*(b2-b1)*((ii-1)*L/500-(b1+b2)/2);

else

if ii<=xx42 Fsx2(ii)=-FBy2;

Mx2(ii)=-FBy2*(d2-(ii-1)*L/500);

else Fsx2(ii)=0;

Mx2(ii)=0;

end end

end end end else

if (b1<=d1)&&(b2<=d2)

FBy2=(q*(b2-d1)^2-q*(d1-b1)^2)/(2*d2-2*d1);

FAy2=q*(b2-b1)-FBy2; for ii=1:leng if ii<=xx21

Fsx2(ii)=0; Mx2(ii)=0; else

if ii<=xx41 Fsx2(ii)=q*((ii-1)*L/500-b1);

Mx2(ii)=-q*((ii-1)*L/500-b1)^2/2;

else

if ii<=xx22 Fsx2(ii)=q*((ii-1)*L/500-b1)-FAy2;

Mx2(ii)=FBy2*(d2-(ii-1)*L/500)-q*(b2-(ii-1)*L/500)^2/2;

else if ii<=xx42

Fsx2(ii)=FBy2;

Mx2(ii)=FBy2*(d2-(ii-1)*L/500);

else Fsx2(ii)=0;

Mx2(ii)=0;

end end end end end else if (b1<=d1)&&(b2<=L)

FBy2=(q*(b2-d1)^2-q*(d1-b1)^2)/(2*d2-2*d1);

FAy2=q*(b2-b1)-FBy2;

for ii=1:leng if ii<=xx21

Fsx2(ii)=0; Mx2(ii)=0; else

if ii<=xx41 Fsx2(ii)=q*((ii-1)*L/500-b1);

Mx2(ii)=-q*((ii-1)*L/500-b1)^2/2;

else if ii<=xx42

Fsx2(ii)=q*((ii-1)*L/500-b1)-FAy2;

Mx2(ii)=FBy2*(d2-(ii-1)*L/500)-q*(b2-(ii-1)*L/500)^2/2;

else if ii<=xx22

Fsx2(ii)=-q*(b2-(ii-1)*L/500);

Mx2(ii)=-q*(b2-(ii-1)*L/500)/2;

else

Fsx2(ii)=0;

Mx2(ii)=0;

end

end end end end else

if (b1>=d1)&&(b2<=d2)

FBy2=q*(b2-b1)*((b1+b2)/2-d1)/(d2-d1);

FAy2=q*(b2-b1)-FBy2;

for ii=1:leng if ii<=xx41 Fsx2(ii)=0;

Mx2(ii)=0;

else if ii<=xx21

Fsx2(ii)=-FAy2;

Mx2(ii)=FAy2*((ii-1)*L/500-d1);

else if ii<=xx22

Fsx2(ii)=q*((ii-1)*L/500-b1)-FAy2;

Mx2(ii)=FAy2*((ii-1)*L/500-d1)-q*((ii-1)*L/500-b1)^2/2;

else

if ii<=xx42

Fsx2(ii)=FBy2;

Mx2(ii)=FBy2*(d2-(ii-1)*L/500);

else

Fsx2(ii)=0;

Mx2(ii)=0;

end

end

end end end else if

(b1>=d1)&&(b1<=d2)&&(b2<=L)

FBy2=q*(b2-b1)*((b1+b2)/2-d1)/(d2-d1);

FAy2=q*(b2-b1)-FBy2;

for ii=1:leng

if ii<=xx41

Fsx2(ii)=0;

Mx2(ii)=0;

else if ii<=xx21

Fsx2(ii)=-FAy2;

Mx2(ii)=FAy2*((ii-1)*L/500-d1);

else

if ii<=xx42

Fsx2(ii)=q*((ii-1)*L/500-b1)-FAy2;

Mx2(ii)=FAy2*((ii-1)*L/500-d1)-q*((ii-1)*L/500-b1)^2/2;

else

if ii<=xx22

Fsx2(ii)=-q*(b2-(ii-1)*L/500);

Mx2(ii)=-q*(b2-(ii-1)*L/500)/2;

else

if ii<=xx22 Fsx2(ii)=0;

Fsx2(ii)=-q*(b2-(ii-1)*L/500); Mx2(ii)=0; end end end end end else FBy2=q*(b2-b1)*((b1+b2)/2-d1)/(d2-d1); FAy2=FBy2-q*(b2-b1); for ii=1:leng if ii<=xx41 Fsx2(ii)=0; Mx2(ii)=0; else if ii<=xx42 Fsx2(ii)=FAy2; Mx2(ii)=-FAy2*((ii-1)*L/500-d1); else if ii<=xx21 Fsx2(ii)=-q*(b2-b1); Mx2(ii)=FBy2*((ii-1)*L/500-d2)-FAy2*((ii-1)*L/500-d1); else

Mx2(ii)=-q*(b2-(ii-1)*L/500)^2/2;

else

Fsx2(ii)=0;

Mx2(ii)=0; end end

end

end end

end end

end end

end

FBy3=M/(d2-d1); FAy3=M/(d2-d1); if c<=d1

for ii=1:leng; if ii<=xx3

Fsx3(ii)=0; Mx3(ii)=0;

else if ii<=xx41

Fsx3(ii)=0; Mx3(ii)=-M;

else if ii<=xx42

Fsx3(ii)=-FBy3;

Mx3(ii)=-FBy3*(d2-(ii-1)*L/500); else

Fsx3(ii)=0; Mx3(ii)=0; end end end end else

if c<=d2

for ii=1:leng if ii<=xx41

Fsx3(ii)=0; Mx3(ii)=0; else

if ii<=xx3 Fsx3(ii)=-FAy3;

Mx3(ii)=FAy3*((ii-1)*L/500-d1);

else

if ii<=xx42 Fsx3(ii)=-FBy3;

Mx3(ii)=-FBy3*(d2-(ii-1)*L/500);

else Fsx3(ii)=0;

Mx3(ii)=0;

end end end end else

for ii=1:leng if ii<=xx41

Fsx3(ii)=0; Mx3(ii)=0; else

if ii<=xx42 Fsx3(ii)=-FAy3;

Mx3(ii)=FAy3*((ii-1)*L/500-d1); else

if ii<=xx3 Fsx3(ii)=0;

Mx3(ii)=M;

else Fsx3(ii)=0;

Mx3(ii)=0;

end end end end end end

flag1=1; flag2=1;

Fsx=Fsx3+Fsx2+Fsx1; Mx=Mx3+Mx2+Mx1; for jj=1:leng

if abs(Fsx(jj))>=abs(Fsx(flag1)) flag1=jj; end

if abs(Mx(jj))>=abs(Mx(flag2)) flag2=jj; end

end yy=0*ones(1,leng); yyy2=abs(Fsx); yyyy2=max(yyy2); yyy3=abs(Mx); yyyy3=max(yyy3); axes(handles.axes2); grid on

plot(x,yy,'LineWidth',2);

axis([0,L,-1.2*yyyy2,1.2*yyyy2]); hold on

plot(x,Fsx,'LineWidth',2); hold on

xxx1=L/500*(flag1-1);

plot(xxx1,Fsx(flag1),'bo','MarkerSize',10);

hold on

for kk=1:4:leng

plot([x(kk),x(kk)],[0,Fsx(kk)],'LineWidth',0.4)

end

xlabel('x/m');

ylabel('??á|Fs/N'); axes(handles.axes3); grid on

plot(x,yy,'LineWidth',2);

axis([0,L,-1.2*yyyy3,1.2*yyyy3]); hold on

plot(x,Mx,'LineWidth',2); hold on

xxx2=L/500*(flag2-1);

plot(xxx2,Mx(flag2),'bo','MarkerSize',10);

for ll=1:4:leng

plot([x(ll),x(ll)],[0,Mx(ll)],'LineWidth',0.4)

end

xlabel('x/m'); ylabel('í???M/N.m'); str1=num2str(yyyy2); str2=num2str(xxx1);

set(handles.edit11,'String',str1); set(handles.edit12,'String',str2); str3=num2str(yyyy3); str4=num2str(xxx2);

set(handles.edit13,'String',str3); set(handles.edit14,'String',str4);

% Hint: get(hObject,'Value') returns toggle state of togglebutton1

% --- Executes on button press in togglebutton2.

function

togglebutton2_Callback(hObject, eventdata, handles)

% hObject handle to togglebutton2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

axes(handles.axes2); cla;

axes(handles.axes3); cla;

str1=num2str(0); str2=num2str(0);

set(handles.edit11,'String',str1); set(handles.edit12,'String',str2); str3=num2str(0); str4=num2str(0);

set(handles.edit13,'String',str3); set(handles.edit14,'String',str4); % Hint: get(hObject,'Value') returns toggle state of togglebutton2

本文来源:https://www.bwwdw.com/article/nct7.html

Top