% 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

