哈工大 材力上机报告 完美版

更新时间:2024-03-25 14:15:01 阅读量: 综合文库 文档下载

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

Harbin Institute of Technology

材料力学上机大作业

报告题目: 简支梁分析程序 院 系: 机电工程学院 班 级: 姓 名: 学 号:

哈尔滨工业大学机电工程学院

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

1、简介

本程序编程平台为matlab 2013a,完成了对受集中力、集中力偶、线性力系共同作用的简支梁上任意点剪力、弯矩、挠度的计算,该程序能够计算任意一点的剪力、弯矩和挠度,并能够绘制出剪力、弯矩、挠度,输出剪力、弯矩、挠度的最大值和取得该最大值的位置;编辑了图形用户界面,有着良好的交互性,方便了用户对相关信息的输入和计算结果的获取。该程序虽然只能用于简支梁,但是该程序具有比较强大的功能。

mkak nbk l ?i?1m

+

aj

cj +

?k?1h bj ?j?1l 2、交互界面

3、使用方法

1、打开matlab(建议使用2012以上版本),选择文件“untitledcailix.m”,打开后运行

gui文件。

2、在输入框中输入已知信息,其中集中力:0-3个,集中力偶:0-3个,均布载荷:0-3

第 1 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

个;

3、全部信息都输入完成后,点击按钮选择截面形状,点击绘制可以生成简支梁的剪力、

弯矩、挠度图线,并计算出剪力、弯矩、挠度的最大值和取到该值的位置。输入取点的位置后能够计算出该点剪力、弯矩、挠度。

注:1、刚开始进入gui界面时,输入框信息全部为0,然后按照自己的需要在相应的输入框内输入数值。

2、选择圆环截面时应注意输入的外径大于内径;

3、本程序编写者使用的matlab版本为2013a,运行平台建议使用matlab 2012以上版本,否则可能造成部分代码无法编译。

4、运行实例

(1)1个集中力作用下的简支梁(矩形截面)分析

(2)1个集中力力与1个力偶作用下的简支梁(圆形截面)分析

第 2 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

(3)2个集中力、3个集中力偶和2个均布力系作用下的简支梁(圆环截面和矩形截面)分析

第 3 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

5、待改进的地方

(1)该程序只能用于简支梁的分析与计算,由于单个用户界面的限制,程序的功能仅局限于对简支梁最多3个集中力+3个集中力偶+3均布力系的计算。这可以通过设计多个用户界面来增加程序的运算功能,同时这也能增强程序的交互性;

(2)程序在计算最大值时,因为MATLAB画图时逐点画图,所以在x=0时所输出的最大值并不是真正的最大值,而是x=0.02时所取的值,而所输出的最大值的x取值在0点处即有0.02的偏差,所以在零点的最大值也有少量的偏差,若需最大值则要得出最大值后然后令x为所取值,点击所选截面按钮,直接计算出该截面的值。

6、体会与收获

这是我第一次接触matlab语言,之前了解到matlab在工程研究领域有着广泛的应用,于是借此机会对matlab进行了一次学习与应用,提高了自学能力和软件应用水平;在本次编程过程中,将课本理论与软件应用进行结合,就好像进行数学语言和编程语言之间的翻译,既对材料力学知识点进行了一次系统的梳理,又熟练了软件的操作;在自主设计用户界面过程中,要充分考虑到用户的需求,锻炼了思维的全面性。

但在编写程序的过程中也遇到了很多的困难,花费了很多的时间,MATLAB在运行程序语言时经常报错,因为程序语言非常的多,在一些微小的地方或执行一些特殊的语句时很难发现和改正错误,在过程中也查阅了很多的资料,询问了一些熟悉MATLAB的人。虽然过程比较艰辛,但是最终做出了程序,有了自己的劳动成果又十分的高兴和满足,自己的行库终于有了回报。

第 4 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

综上,本次材料力学上机大作业的完成使我受益匪浅,让我们将课堂上的理论转化成了实际的实践成果,是一次非常有意义的学习。

7、程序源代码(in Matlab GUI)

function varargout = untitledcailix(varargin)

% UNTITLEDCAILIX MATLAB code for untitledcailix.fig % UNTITLEDCAILIX, by itself, creates a new UNTITLEDCAILIX or raises the existing

% singleton*. %

% H = UNTITLEDCAILIX returns the handle to a new UNTITLEDCAILIX or the handle to

% the existing singleton*. %

% UNTITLEDCAILIX('CALLBACK',hObject,eventData,handles,...) calls the local

% function named CALLBACK in UNTITLEDCAILIX.M with the given input arguments. %

% UNTITLEDCAILIX('Property','Value',...) creates a new UNTITLEDCAILIX or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before untitledcailix_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to untitledcailix_OpeningFcn via varargin. %

% *See GUI Options on GUIDE's Tools menu. Choose \only one % instance to run (singleton)\ %

% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help untitledcailix

% Last Modified by GUIDE v2.5 08-Jun-2014 16:09:18

% Begin initialization code - DO NOT EDIT gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename, ...

'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @untitledcailix_OpeningFcn, ... 'gui_OutputFcn', @untitledcailix_OutputFcn, ... 'gui_LayoutFcn', [] , ...

第 5 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

'gui_Callback', []); if nargin && ischar(varargin{1})

gui_State.gui_Callback = str2func(varargin{1}); end

if nargout

[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else

gui_mainfcn(gui_State, varargin{:}); end

% End initialization code - DO NOT EDIT

% --- Executes just before untitledcailix is made visible.

function untitledcailix_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% varargin command line arguments to untitledcailix (see VARARGIN)

% Choose default command line output for untitledcailix handles.output = hObject; axes(handles.axes4);

[A,map]=imread('01.jpg'); imshow(A,map);

axes(handles.axes6);

[B,map]=imread('02.jpg'); imshow(B,map);

axes(handles.axes7);

[C,map]=imread('03.jpg'); imshow(C,map);

% Update handles structure guidata(hObject, handles);

% UIWAIT makes untitledcailix wait for user response (see UIRESUME) % uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.

function varargout = untitledcailix_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

第 6 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

% Get default command line output from handles structure varargout{1} = handles.output;

function edit21_Callback(hObject, eventdata, handles) % hObject handle to edit21 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit21 as text

% str2double(get(hObject,'String')) returns contents of edit21 as a double

% --- Executes during object creation, after setting all properties. function edit21_CreateFcn(hObject, eventdata, handles) % hObject handle to edit21 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit22_Callback(hObject, eventdata, handles) % hObject handle to edit22 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit22 as text

% str2double(get(hObject,'String')) returns contents of edit22 as a double

% --- Executes during object creation, after setting all properties. function edit22_CreateFcn(hObject, eventdata, handles) % hObject handle to edit22 (see GCBO)

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

第 7 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit23_Callback(hObject, eventdata, handles) % hObject handle to edit23 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit23 as text

% str2double(get(hObject,'String')) returns contents of edit23 as a double

% --- Executes during object creation, after setting all properties. function edit23_CreateFcn(hObject, eventdata, handles) % hObject handle to edit23 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit24_Callback(hObject, eventdata, handles) % hObject handle to edit24 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit24 as text

% str2double(get(hObject,'String')) returns contents of edit24 as a double

第 8 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

% --- Executes during object creation, after setting all properties. function edit24_CreateFcn(hObject, eventdata, handles) % hObject handle to edit24 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit25_Callback(hObject, eventdata, handles) % hObject handle to edit25 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit25 as text

% str2double(get(hObject,'String')) returns contents of edit25 as a double

% --- Executes during object creation, after setting all properties. function edit25_CreateFcn(hObject, eventdata, handles) % hObject handle to edit25 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit26_Callback(hObject, eventdata, handles) % hObject handle to edit26 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

第 9 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

% Hints: get(hObject,'String') returns contents of edit20 as text

% str2double(get(hObject,'String')) returns contents of edit20 as a double

% --- Executes during object creation, after setting all properties. function edit20_CreateFcn(hObject, eventdata, handles) % hObject handle to edit20 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit12_Callback(hObject, eventdata, handles) % hObject handle to edit12 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit12 as text

% str2double(get(hObject,'String')) returns contents of edit12 as a double

% --- Executes during object creation, after setting all properties. function edit12_CreateFcn(hObject, eventdata, handles) % hObject handle to edit12 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

第 15 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

function edit13_Callback(hObject, eventdata, handles) % hObject handle to edit13 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit13 as text

% str2double(get(hObject,'String')) returns contents of edit13 as a double

% --- Executes during object creation, after setting all properties. function edit13_CreateFcn(hObject, eventdata, handles) % hObject handle to edit13 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit14_Callback(hObject, eventdata, handles) % hObject handle to edit14 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit14 as text

% str2double(get(hObject,'String')) returns contents of edit14 as a double

% --- Executes during object creation, after setting all properties. function edit14_CreateFcn(hObject, eventdata, handles) % hObject handle to edit14 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'),

第 16 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit6_Callback(hObject, eventdata, handles) % hObject handle to edit6 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit6 as text

% str2double(get(hObject,'String')) returns contents of edit6 as a double

% --- Executes during object creation, after setting all properties. function edit6_CreateFcn(hObject, eventdata, handles) % hObject handle to edit6 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit7_Callback(hObject, eventdata, handles) % hObject handle to edit7 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit7 as text

% str2double(get(hObject,'String')) returns contents of edit7 as a double

% --- Executes during object creation, after setting all properties. function edit7_CreateFcn(hObject, eventdata, handles) % hObject handle to edit7 (see GCBO)

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

第 17 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit8_Callback(hObject, eventdata, handles) % hObject handle to edit8 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit8 as text

% str2double(get(hObject,'String')) returns contents of edit8 as a double

% --- Executes during object creation, after setting all properties. function edit8_CreateFcn(hObject, eventdata, handles) % hObject handle to edit8 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit9_Callback(hObject, eventdata, handles) % hObject handle to edit9 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit9 as text

% str2double(get(hObject,'String')) returns contents of edit9 as a double

第 18 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

% --- Executes during object creation, after setting all properties. function edit9_CreateFcn(hObject, eventdata, handles) % hObject handle to edit9 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit10_Callback(hObject, eventdata, handles) % hObject handle to edit10 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit10 as text

% str2double(get(hObject,'String')) returns contents of edit10 as a double

% --- Executes during object creation, after setting all properties. function edit10_CreateFcn(hObject, eventdata, handles) % hObject handle to edit10 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit11_Callback(hObject, eventdata, handles) % hObject handle to edit11 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

第 19 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

% Hints: get(hObject,'String') returns contents of edit11 as text

% str2double(get(hObject,'String')) returns contents of edit11 as a double

% --- Executes during object creation, after setting all properties. function edit11_CreateFcn(hObject, eventdata, handles) % hObject handle to edit11 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

% --- Executes on button press in pushbutton1.

function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) l=str2num(get(handles.edit1,'string')); E=str2num(get(handles.edit2,'string')); b=str2num(get(handles.edit3,'string')); h=str2num(get(handles.edit4,'string')); f1=str2num(get(handles.edit6,'string')); F1=str2num(get(handles.edit7,'string')); f2=str2num(get(handles.edit8,'string')); F2=str2num(get(handles.edit9,'string')); f3=str2num(get(handles.edit10,'string')); F3=str2num(get(handles.edit11,'string')); x=str2num(get(handles.edit5,'string')); I=(b*h^3)/(12e12); fc1=l-f1;

FA1=F1*fc1/l; FB1=F1*f1/l; if x

v1=-F1*fc1*x*(l^2-x^2-fc1^2)/(6*E*I*l*1e9); else

第 20 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

FJ1=FB1

M1=FA1*x-F1*(x-f1);

v1=-F1*fc1*(l/fc1*(x-f1)^3+(l^2-fc1^2)*x-x^3)/(6*E*I*l*1e9); end

fc2=l-f2;

FA2=F2*fc2/l; FB2=F2*f2/l; if x

v2=-F2*fc2*x*(l^2-x^2-fc2^2)/(6*E*I*l*1e9); else FJ2=FB2

M2=FA2*x-F2*(x-f2);

v2=-F2*fc2*(l/fc2*(x-f2)^3+(l^2-fc2^2)*x-x^3)/(6*E*I*l*1e9); end

fc3=l-f3;

FA3=F3*fc3/l; FB3=F3*f3/l; if x

v3=-F3*fc3*x*(l^2-x^2-fc3^2)/(6*E*I*l*1e9); else FJ3=FB3

M3=FA3*x-F3*(x-f3);

v3=-F3*fc3*(l/fc3*(x-f3)^3+(l^2-fc3^2)*x-x^3)/(6*E*I*l*1e9); end

m1=str2num(get(handles.edit15,'string')); M11=str2num(get(handles.edit16,'string')); m2=str2num(get(handles.edit17,'string')); M22=str2num(get(handles.edit18,'string')); m3=str2num(get(handles.edit19,'string')); M33=str2num(get(handles.edit20,'string'));

FAm1=-M11/l; %求支反力% FBm1=M11/l; FJ4=FBm1; cm1=l-m1 if x

v4=M11*x*1e3/(6*E*I*l*1e9)*(l^2-3*cm1^2-x^2); else

M4=FAm1*x+M11;

v4=M11*1e3/(6*E*I*l*1e9)*(-x^3+3*l*(x-m1)^2+(l^2-3*cm1^2)*x); end

第 21 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

FAm2=-M22/l; %求支反力% FBm2=M22/l; cm2=l-m2 FJ5=FBm2 if x

v5=M22*x*1e3/(6*E*I*l*1e9)*(l^2-3*cm2^2-x^2); else

M5=FAm2*x+M22;

v5=M22*1e3/(6*E*I*l*1e9)*(-x^3+3*l*(x-m2)^2+(l^2-3*cm2^2)*x); end

FAm3=-M33/l; %求支反力% FBm3=M33/l; cm3=l-m3 FJ6=FBm3 if x

v6=M33*x*1e3/(6*E*I*l*1e9)*(l^2-3*cm3^2-x^2); else

M6=FAm3*x+M33;

v6=M33*1e3/(6*E*I*l*1e9)*(-x^3+3*l*(x-m3)^2+(l^2-3*cm3^2)*x); end

aj1=str2num(get(handles.edit27,'string')); q1=str2num(get(handles.edit21,'string')); aj2=str2num(get(handles.edit28,'string')); q2=str2num(get(handles.edit23,'string')); aj3=str2num(get(handles.edit29,'string')); q3=str2num(get(handles.edit25,'string')); cj1=str2num(get(handles.edit22,'string')); cj2=str2num(get(handles.edit24,'string')); cj3=str2num(get(handles.edit26,'string')); bj1=l-aj1-cj1;

FAq1=q1*cj1*(bj1+cj1/2)/l; FBq1=q1*cj1*(aj1+cj1/2)/l;

ccc3=(FAq1*(aj1+cj1)^3)/(3*l)-(q1*aj1*cj1^3)/(6*l)-(q1*cj1^4)/(8*l)+(FBq1*bj1^2)/2-(FBq1* bj1^3)/(3*l);

ccc2=ccc3-(FBq1*bj1^2)/2-(FAq1*(aj1+cj1)^2)/2+(q1*cj1^3)/6; ccc1=ccc2; ddd3=-ccc3*l; if x

FJ7=-FAq1 M7=FAq1*x;

v7=((FAq1* x^3)/6+ccc1*x)/(E*I*1e6); else if aj1<=x

FJ7=-FAq1+q1*(x-aj1)

第 22 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

M7=FAq1*x-(x-aj1)^2/2*q1;

v7=((FAq1* x^3)/6-(q1* (x-aj1)^4)/24+ccc2*x)/(E*I*1e6); else

FJ7=FBq1 M7=FBq1*(l-x);

v7=((FBq1* (l-x)^3)/6+ccc3*x+ddd3)/(E*I*1e6); end end

bj2=l-aj2-cj2;

FAq2=q2*cj2*(bj2+cj2/2)/l; FBq2=q2*cj2*(aj2+cj2/2)/l;

cc3=(FAq2*(aj2+cj2)^3)/(3*l)-(q2*aj2*cj2^3)/(6*l)-(q2*cj2^4)/(8*l)+(FBq2*bj2^2)/2-(FBq2* bj2^3)/(3*l);

cc2=cc3-(FBq2*bj2^2)/2-(FAq2*(aj2+cj2)^2)/2+(q2*cj2^3)/6; cc1=cc2; dd3=-cc3*l; if x

FJ8=-FAq2 M8=FAq2*x;

v8=((FAq2* x^3)/6+cc1*x)/(E*I*1e6); else if aj2<=x

FJ8=-FAq2+q2*(x-aj2) M8=FAq2*x-(x-aj2)^2/2*q2;

v8=((FAq2* x^3)/6-(q2* (x-aj2)^4)/24+cc2*x)/(E*I*1e6); else

FJ8=FBq2 M8=FBq2*(l-x);

v8=((FBq2* (l-x)^3)/6+cc3*x+dd3)/(E*I*1e6); end end

bj3=l-aj3-cj3;

FAq3=q3*cj3*(bj3+cj3/2)/l; FBq3=q3*cj3*(aj3+cj3/2)/l;

c3=(FAq3*(aj3+cj3)^3)/(3*l)-(q3*aj3*cj3^3)/(6*l)-(q3*cj3^4)/(8*l)+(FBq3*bj3^2)/2-(FBq3* bj3^3)/(3*l);

c2=c3-(FBq3*bj3^2)/2-(FAq3*(aj3+cj3)^2)/2+(q3*cj3^3)/6; c1=c2; d3=-c3*l; if x

FJ9=-FAq3 M9=FAq3*x;

v9=((FAq3* x^3)/6+c1*x)/(E*I*1e6); else if aj3<=x

FJ9=-FAq3+q3*(x-aj3) M9=FAq3*x-(x-aj3)^2/2*q3;

第 23 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

v9=((FAq3* x^3)/6-(q3* (x-aj3)^4)/24+c2*x)/(E*I*1e6); else

FJ9=FBq3 M9=FBq3*(l-x);

v9=((FBq3* (l-x)^3)/6+c3*x+d3)/(E*I*1e6); end end

FJ=FJ1+FJ2+FJ3+FJ4+FJ5+FJ6+FJ7+FJ8+FJ9 M=M1+M2+M3+M4+M5+M6+M7+M8+M9;

v=(v1+v2+v3)*1e3+v4+v5+v6+v7+v8+v9;

set(handles.edit14,'string',num2str(FJ)); set(handles.edit12,'string',num2str(M)); set(handles.edit13,'string',num2str(v));

% --- Executes on button press in pushbutton2.

function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) l=str2num(get(handles.edit1,'string')); E=str2num(get(handles.edit2,'string')); b=str2num(get(handles.edit3,'string')); h=str2num(get(handles.edit4,'string')); f1=str2num(get(handles.edit6,'string')); F1=str2num(get(handles.edit7,'string')); f2=str2num(get(handles.edit8,'string')); F2=str2num(get(handles.edit9,'string')); f3=str2num(get(handles.edit10,'string')); F3=str2num(get(handles.edit11,'string')); x=str2num(get(handles.edit5,'string')); I=pi*(b^4-h^4)/(64e12); fc1=l-f1;

FA1=F1*fc1/l; FB1=F1*f1/l; if x

v1=-F1*fc1*x*(l^2-x^2-fc1^2)/(6*E*I*l*1e9); else FJ1=FB1

第 24 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

M1=FA1*x-F1*(x-f1);

v1=-F1*fc1*(l/fc1*(x-f1)^3+(l^2-fc1^2)*x-x^3)/(6*E*I*l*1e9); end

fc2=l-f2;

FA2=F2*fc2/l; FB2=F2*f2/l; if x

v2=-F2*fc2*x*(l^2-x^2-fc2^2)/(6*E*I*l*1e9); else FJ2=FB2

M2=FA2*x-F2*(x-f2);

v2=-F2*fc2*(l/fc2*(x-f2)^3+(l^2-fc2^2)*x-x^3)/(6*E*I*l*1e9); end

fc3=l-f3;

FA3=F3*fc3/l; FB3=F3*f3/l; if x

v3=-F3*fc3*x*(l^2-x^2-fc3^2)/(6*E*I*l*1e9); else FJ3=FB3

M3=FA3*x-F3*(x-f3);

v3=-F3*fc3*(l/fc3*(x-f3)^3+(l^2-fc3^2)*x-x^3)/(6*E*I*l*1e9); end

m1=str2num(get(handles.edit15,'string')); M11=str2num(get(handles.edit16,'string')); m2=str2num(get(handles.edit17,'string')); M22=str2num(get(handles.edit18,'string')); m3=str2num(get(handles.edit19,'string')); M33=str2num(get(handles.edit20,'string'));

FAm1=-M11/l; %求支反力% FBm1=M11/l; FJ4=FBm1; cm1=l-m1 if x

v4=M11*x*1e3/(6*E*I*l*1e9)*(l^2-3*cm1^2-x^2); else

M4=FAm1*x+M11;

v4=M11*1e3/(6*E*I*l*1e9)*(-x^3+3*l*(x-m1)^2+(l^2-3*cm1^2)*x); end

FAm2=-M22/l; %求支反力%

第 25 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

FBm2=M22/l; cm2=l-m2 FJ5=FBm2 if x

v5=M22*x*1e3/(6*E*I*l*1e9)*(l^2-3*cm2^2-x^2); else

M5=FAm2*x+M22;

v5=M22*1e3/(6*E*I*l*1e9)*(-x^3+3*l*(x-m2)^2+(l^2-3*cm2^2)*x); end

FAm3=-M33/l; %求支反力% FBm3=M33/l; cm3=l-m3 FJ6=FBm3 if x

v6=M33*x*1e3/(6*E*I*l*1e9)*(l^2-3*cm3^2-x^2); else

M6=FAm3*x+M33;

v6=M33*1e3/(6*E*I*l*1e9)*(-x^3+3*l*(x-m3)^2+(l^2-3*cm3^2)*x); end

aj1=str2num(get(handles.edit27,'string')); q1=str2num(get(handles.edit21,'string')); aj2=str2num(get(handles.edit28,'string')); q2=str2num(get(handles.edit23,'string')); aj3=str2num(get(handles.edit29,'string')); q3=str2num(get(handles.edit25,'string')); cj1=str2num(get(handles.edit22,'string')); cj2=str2num(get(handles.edit24,'string')); cj3=str2num(get(handles.edit26,'string')); bj1=l-aj1-cj1;

FAq1=q1*cj1*(bj1+cj1/2)/l; FBq1=q1*cj1*(aj1+cj1/2)/l;

ccc3=(FAq1*(aj1+cj1)^3)/(3*l)-(q1*aj1*cj1^3)/(6*l)-(q1*cj1^4)/(8*l)+(FBq1*bj1^2)/2-(FBq1* bj1^3)/(3*l);

ccc2=ccc3-(FBq1*bj1^2)/2-(FAq1*(aj1+cj1)^2)/2+(q1*cj1^3)/6; ccc1=ccc2; ddd3=-ccc3*l; if x

FJ7=-FAq1 M7=FAq1*x;

v7=((FAq1* x^3)/6+ccc1*x)/(E*I*1e6); else if aj1<=x

FJ7=-FAq1+q1*(x-aj1) M7=FAq1*x-(x-aj1)^2/2*q1;

第 26 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

v7=((FAq1* x^3)/6-(q1* (x-aj1)^4)/24+ccc2*x)/(E*I*1e6); else

FJ7=FBq1 M7=FBq1*(l-x);

v7=((FBq1* (l-x)^3)/6+ccc3*x+ddd3)/(E*I*1e6); end end

bj2=l-aj2-cj2;

FAq2=q2*cj2*(bj2+cj2/2)/l; FBq2=q2*cj2*(aj2+cj2/2)/l;

cc3=(FAq2*(aj2+cj2)^3)/(3*l)-(q2*aj2*cj2^3)/(6*l)-(q2*cj2^4)/(8*l)+(FBq2*bj2^2)/2-(FBq2* bj2^3)/(3*l);

cc2=cc3-(FBq2*bj2^2)/2-(FAq2*(aj2+cj2)^2)/2+(q2*cj2^3)/6; cc1=cc2; dd3=-cc3*l; if x

FJ8=-FAq2 M8=FAq2*x;

v8=((FAq2* x^3)/6+cc1*x)/(E*I*1e6); else if aj2<=x

FJ8=-FAq2+q2*(x-aj2) M8=FAq2*x-(x-aj2)^2/2*q2;

v8=((FAq2* x^3)/6-(q2* (x-aj2)^4)/24+cc2*x)/(E*I*1e6); else

FJ8=FBq2 M8=FBq2*(l-x);

v8=((FBq2* (l-x)^3)/6+cc3*x+dd3)/(E*I*1e6); end end

bj3=l-aj3-cj3;

FAq3=q3*cj3*(bj3+cj3/2)/l; FBq3=q3*cj3*(aj3+cj3/2)/l;

c3=(FAq3*(aj3+cj3)^3)/(3*l)-(q3*aj3*cj3^3)/(6*l)-(q3*cj3^4)/(8*l)+(FBq3*bj3^2)/2-(FBq3* bj3^3)/(3*l);

c2=c3-(FBq3*bj3^2)/2-(FAq3*(aj3+cj3)^2)/2+(q3*cj3^3)/6; c1=c2; d3=-c3*l; if x

FJ9=-FAq3 M9=FAq3*x;

v9=((FAq3* x^3)/6+c1*x)/(E*I*1e6); else if aj3<=x

FJ9=-FAq3+q3*(x-aj3) M9=FAq3*x-(x-aj3)^2/2*q3;

v9=((FAq3* x^3)/6-(q3* (x-aj3)^4)/24+c2*x)/(E*I*1e6);

第 27 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

else

FJ9=FBq3 M9=FBq3*(l-x);

v9=((FBq3* (l-x)^3)/6+c3*x+d3)/(E*I*1e6); end end

FJ=FJ1+FJ2+FJ3+FJ4+FJ5+FJ6+FJ7+FJ8+FJ9 M=M1+M2+M3+M4+M5+M6+M7+M8+M9;

v=(v1+v2+v3)*1e3+v4+v5+v6+v7+v8+v9;

set(handles.edit14,'string',num2str(FJ)); set(handles.edit12,'string',num2str(M)); set(handles.edit13,'string',num2str(v));

function edit5_Callback(hObject, eventdata, handles) % hObject handle to edit5 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit5 as text

% str2double(get(hObject,'String')) returns contents of edit5 as a double

% --- Executes during object creation, after setting all properties. function edit5_CreateFcn(hObject, eventdata, handles) % hObject handle to edit5 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit1_Callback(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

第 28 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

% Hints: get(hObject,'String') returns contents of edit1 as text

% str2double(get(hObject,'String')) returns contents of edit1 as a double

% --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit2_Callback(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit2 as text

% str2double(get(hObject,'String')) returns contents of edit2 as a double

% --- Executes during object creation, after setting all properties. function edit2_CreateFcn(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

第 29 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

function edit3_Callback(hObject, eventdata, handles) % hObject handle to edit3 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit3 as text

% str2double(get(hObject,'String')) returns contents of edit3 as a double

% --- Executes during object creation, after setting all properties. function edit3_CreateFcn(hObject, eventdata, handles) % hObject handle to edit3 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit4_Callback(hObject, eventdata, handles) % hObject handle to edit4 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit4 as text

% str2double(get(hObject,'String')) returns contents of edit4 as a double

% --- Executes during object creation, after setting all properties. function edit4_CreateFcn(hObject, eventdata, handles) % hObject handle to edit4 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

第 30 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

set(hObject,'BackgroundColor','white'); end

function edit30_Callback(hObject, eventdata, handles) % hObject handle to edit30 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit30 as text

% str2double(get(hObject,'String')) returns contents of edit30 as a double

% --- Executes during object creation, after setting all properties. function edit30_CreateFcn(hObject, eventdata, handles) % hObject handle to edit30 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit31_Callback(hObject, eventdata, handles) % hObject handle to edit31 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit31 as text

% str2double(get(hObject,'String')) returns contents of edit31 as a double

% --- Executes during object creation, after setting all properties. function edit31_CreateFcn(hObject, eventdata, handles) % hObject handle to edit31 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

第 31 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit32_Callback(hObject, eventdata, handles) % hObject handle to edit32 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit32 as text

% str2double(get(hObject,'String')) returns contents of edit32 as a double

% --- Executes during object creation, after setting all properties. function edit32_CreateFcn(hObject, eventdata, handles) % hObject handle to edit32 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit33_Callback(hObject, eventdata, handles) % hObject handle to edit33 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit33 as text

% str2double(get(hObject,'String')) returns contents of edit33 as a double

第 32 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

% --- Executes during object creation, after setting all properties. function edit33_CreateFcn(hObject, eventdata, handles) % hObject handle to edit33 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit34_Callback(hObject, eventdata, handles) % hObject handle to edit34 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit34 as text

% str2double(get(hObject,'String')) returns contents of edit34 as a double

% --- Executes during object creation, after setting all properties. function edit34_CreateFcn(hObject, eventdata, handles) % hObject handle to edit34 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function edit35_Callback(hObject, eventdata, handles) % hObject handle to edit35 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

第 33 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

% Hints: get(hObject,'String') returns contents of edit35 as text

% str2double(get(hObject,'String')) returns contents of edit35 as a double

% --- Executes during object creation, after setting all properties. function edit35_CreateFcn(hObject, eventdata, handles) % hObject handle to edit35 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

% -------------------------------------------------------------------- function Untitled_1_Callback(hObject, eventdata, handles) % hObject handle to Untitled_1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% --- Executes during object creation, after setting all properties. function axes4_CreateFcn(hObject, eventdata, handles) % hObject handle to axes4 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: place code in OpeningFcn to populate axes4

% --- Executes during object creation, after setting all properties. function axes6_CreateFcn(hObject, eventdata, handles) % hObject handle to axes6 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: place code in OpeningFcn to populate axes6

第 34 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

% --- Executes during object creation, after setting all properties. function axes7_CreateFcn(hObject, eventdata, handles) % hObject handle to axes7 (see GCBO)

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

% handles empty - handles not created until after all CreateFcns called

% Hint: place code in OpeningFcn to populate axes7

% --- Executes on button press in pushbutton5.

function pushbutton5_Callback(hObject, eventdata, handles) % hObject handle to pushbutton5 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) l=str2num(get(handles.edit1,'string')); EE=str2num(get(handles.edit2,'string')); b=str2num(get(handles.edit3,'string')); h=str2num(get(handles.edit4,'string')); E=EE*1e9;

I=b*h^3/(12e12);

a=[];b=[];

a(1)=str2num(get(handles.edit6,'string')); a(2)=str2num(get(handles.edit8,'string')); a(3)=str2num(get(handles.edit10,'string')); F=[];F1=[];F2=[];

F(1)=str2num(get(handles.edit7,'string')); F(2)=str2num(get(handles.edit9,'string')); F(3)=str2num(get(handles.edit11,'string'));

am=[];bm=[];

am(4)=str2num(get(handles.edit15,'string')); am(5)=str2num(get(handles.edit17,'string')); am(6)=str2num(get(handles.edit19,'string')); Mi=[];Fm1=[];Fm2=[];

Mi(4)=str2num(get(handles.edit16,'string')); Mi(5)=str2num(get(handles.edit18,'string')); Mi(6)=str2num(get(handles.edit20,'string'));

aq=[];cq=[];

aq(7)=str2num(get(handles.edit27,'string')); aq(8)=str2num(get(handles.edit28,'string')); aq(9)=str2num(get(handles.edit29,'string')); cq(7)=str2num(get(handles.edit22,'string')); cq(8)=str2num(get(handles.edit24,'string'));

第 35 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

cq(9)=str2num(get(handles.edit26,'string')); q=[];

q(7)=str2num(get(handles.edit21,'string')); q(8)=str2num(get(handles.edit23,'string')); q(9)=str2num(get(handles.edit25,'string'));

M=zeros(100,100);V=zeros(100,100); m=[];v=[];fs=[]; n1=3; n2=3; n3=2;

%????3?????????ú?ú?????????????????? for i=1:1:3; for j=1:1:100; x=j*l/100; b(i)=l-a(i);

F1(i)=(F(i)*b(i))/l; F2(i)=(F(i)*a(i))/l; if 0<=x&x<=a(i) M(i,j)=F1(i)*x;

V(i,j)=-F(i)*b(i)*x*(l*l-x*x-b(i)*b(i))/(6*E*I*l); FS(i,j)=-F(i); else

M(i,j)=F2(i)*(l-x);

V(i,j)=-F(i)*b(i)*((l/b(i))*

(x-a(i))^3+(l*l-b(i)*b(i))*x-x^3)/(6*E*I*l); FS(i,j)=F(i); end end end

%????3???????????ú?ú?????????????????? for i=4:1:6;

for j=1:1:100;

x=j*l/100; bm(i)=l-am(i); Fm1(i)=-Mi(i)/l;

Fm2(i)=Mi(i)/l; if 0<=x&x<=am(i) M(i,j)=Fm1(i)*x;

V(i,j)=Mi(i)*x*(l*l-3*bm(i)*bm(i)-x*x)/(6*E*I*l); FS(i,j)=0; else

M(i,j)=Fm2(i)*(l-x);

V(i,j)=Mi(i)*(-x^3+3*l*(x-am(i))^2+(l*l-3*bm(i)*bm(i))*x)/(6*E*I*l);

第 36 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

FS(i,j)=0; end end end

%????m???ù???????????ú?ú?????????????????? for i=7:1:9;

for j=1:1:100; x=j*l/100;

b=l-aq(i)-cq(i);

F1=(q(i)*cq(i)*(cq(i)+2*b))/(2*l);

F2=(q(i)*cq(i)*(cq(i)+2*aq(i)))/(2*l);

c3=(F1*(aq(i)+cq(i))^3)/(3*l)-(q(i)*aq(i)*cq(i)^3)/(6*l)-(q(i)*cq(i)^4)/(8*l)+(F2*b^2)/2-(F2* b^3)/(3*l);

c2=c3-(F2*b^2)/2-(F1*(aq(i)+cq(i))^2)/2+(q(i)*cq(i)^3)/6; c1=c2; d3=-c3*l;

if x>=0&x<=aq(i)

V(i,j)=((F1* x^3)/6+c1*x)/(E*I); M(i,j)=F1*x;

FS(i,j)=-cq(i)*q(i)*(l-aq(i)-cq(i)/2)/l; elseif x>aq(i)&x<=aq(i)+cq(i)

V(i,j)=((F1* x^3)/6-(q(i)* (x-aq(i))^4)/24+c2*x)/(E*I);

M(i,j)=((q(i)*cq(i)*x*(cq(i)+2*b))/(2*l))/(1e6)-((q(i)*(x-aq(i))^2)/2);

FS(i,j)=q(i)*l*(x-aq(i))/l-cq(i)*q(i)*(l-aq(i)-cq(i)/2)/l; else

V(i,j)=((F2* (l-x)^3)/6+c3*x+d3)/(E*I); M(i,j)=F2*(l-x);

FS(i,j)=cq(i)*q(i)*(aq(i)+cq(i)/2)/l; end end end

%???????????????????????? m=zeros(1,100); v=zeros(1,100); fs=zeros(1,100); for j=1:1:100

for i=1:1:n1+n2+n3 m(j)=m(j)+ M(i,j); v(j)=v(j)+ V(i,j); fs(j)=fs(j)+ FS(i,j); end

第 37 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

end

%?????????????? j=1:1:100; x1=j*l/100; y1=m(j);

area(handles.axes1,x1,y1);

h_t1=title(handles.axes1,'弯矩图'); %???????????ú???? j=1:1:100; x2=j*l/100; y2=v(j)*1e3;

area(handles.axes2,x2,y2);

h_t1=title(handles.axes2,'挠度图'); %?????????????? j=1:1:100; x3=j*l/100; y3=fs(j);

area(handles.axes3,x3,y3);

h_t1=title(handles.axes3,'剪力图'); Mmax=abs(y1); vmax=abs(y2) Fmax=abs(y3) Mmax1=max(Mmax) vmax1=max(vmax) Fmax1=max(Fmax)

set(handles.edit30,'string',num2str(Mmax1)); set(handles.edit31,'string',num2str(vmax1)); set(handles.edit32,'string',num2str(Fmax1)); id1=find(Mmax==Mmax1); xm1=x1(id1)

id2=find(vmax==vmax1); xm2=x2(id2)

id3=find(Fmax==Fmax1); xm3=x3(id3)

set(handles.edit33,'string',num2str(xm1)); set(handles.edit34,'string',num2str(xm2)); set(handles.edit35,'string',num2str(xm3));

% --- Executes on button press in pushbutton6.

function pushbutton6_Callback(hObject, eventdata, handles) % hObject handle to pushbutton6 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

第 38 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

l=str2num(get(handles.edit1,'string')); EE=str2num(get(handles.edit2,'string')); b=str2num(get(handles.edit3,'string')); h=str2num(get(handles.edit4,'string')); E=EE*1e9;

I=pi*(b^4-h^4)/(64e12);

a=[];b=[];

a(1)=str2num(get(handles.edit6,'string')); a(2)=str2num(get(handles.edit8,'string')); a(3)=str2num(get(handles.edit10,'string')); F=[];F1=[];F2=[];

F(1)=str2num(get(handles.edit7,'string')); F(2)=str2num(get(handles.edit9,'string')); F(3)=str2num(get(handles.edit11,'string'));

am=[];bm=[];

am(4)=str2num(get(handles.edit15,'string')); am(5)=str2num(get(handles.edit17,'string')); am(6)=str2num(get(handles.edit19,'string')); Mi=[];Fm1=[];Fm2=[];

Mi(4)=str2num(get(handles.edit16,'string')); Mi(5)=str2num(get(handles.edit18,'string')); Mi(6)=str2num(get(handles.edit20,'string'));

aq=[];cq=[];

aq(7)=str2num(get(handles.edit27,'string')); aq(8)=str2num(get(handles.edit28,'string')); aq(9)=str2num(get(handles.edit29,'string')); cq(7)=str2num(get(handles.edit22,'string')); cq(8)=str2num(get(handles.edit24,'string')); cq(9)=str2num(get(handles.edit26,'string')); q=[];

q(7)=str2num(get(handles.edit21,'string')); q(8)=str2num(get(handles.edit23,'string')); q(9)=str2num(get(handles.edit25,'string'));

M=zeros(100,100);V=zeros(100,100); m=[];v=[];fs=[]; n1=3; n2=3; n3=2;

%????3?????????ú?ú?????????????????? for i=1:1:3; for j=1:1:100;

第 39 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

x=j*l/100; b(i)=l-a(i);

F1(i)=(F(i)*b(i))/l; F2(i)=(F(i)*a(i))/l; if 0<=x&x<=a(i) M(i,j)=F1(i)*x;

V(i,j)=-F(i)*b(i)*x*(l*l-x*x-b(i)*b(i))/(6*E*I*l); FS(i,j)=-F(i); else

M(i,j)=F2(i)*(l-x);

V(i,j)=-F(i)*b(i)*((l/b(i))*

(x-a(i))^3+(l*l-b(i)*b(i))*x-x^3)/(6*E*I*l); FS(i,j)=F(i); end end end

%????3???????????ú?ú?????????????????? for i=4:1:6;

for j=1:1:100;

x=j*l/100; bm(i)=l-am(i); Fm1(i)=-Mi(i)/l;

Fm2(i)=Mi(i)/l; if 0<=x&x<=am(i) M(i,j)=Fm1(i)*x;

V(i,j)=Mi(i)*x*(l*l-3*bm(i)*bm(i)-x*x)/(6*E*I*l); FS(i,j)=0; else

M(i,j)=Fm2(i)*(l-x);

V(i,j)=Mi(i)*(-x^3+3*l*(x-am(i))^2+(l*l-3*bm(i)*bm(i))*x)/(6*E*I*l); FS(i,j)=0; end end end

%????m???ù???????????ú?ú?????????????????? for i=7:1:9;

for j=1:1:100; x=j*l/100;

b=l-aq(i)-cq(i);

F1=(q(i)*cq(i)*(cq(i)+2*b))/(2*l);

F2=(q(i)*cq(i)*(cq(i)+2*aq(i)))/(2*l);

c3=(F1*(aq(i)+cq(i))^3)/(3*l)-(q(i)*aq(i)*cq(i)^3)/(6*l)-(q(i)*cq(i)^4)/(8*l)+(F2*b^2)/2-(F2* b^3)/(3*l);

第 40 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

c2=c3-(F2*b^2)/2-(F1*(aq(i)+cq(i))^2)/2+(q(i)*cq(i)^3)/6; c1=c2; d3=-c3*l;

if x>=0&x<=aq(i)

V(i,j)=((F1* x^3)/6+c1*x)/(E*I); M(i,j)=F1*x;

FS(i,j)=-cq(i)*q(i)*(l-aq(i)-cq(i)/2)/l; elseif x>aq(i)&x<=aq(i)+cq(i)

V(i,j)=((F1* x^3)/6-(q(i)* (x-aq(i))^4)/24+c2*x)/(E*I);

M(i,j)=((q(i)*cq(i)*x*(cq(i)+2*b))/(2*l))/(1e6)-((q(i)*(x-aq(i))^2)/2);

FS(i,j)=q(i)*l*(x-aq(i))/l-cq(i)*q(i)*(l-aq(i)-cq(i)/2)/l; else

V(i,j)=((F2* (l-x)^3)/6+c3*x+d3)/(E*I); M(i,j)=F2*(l-x);

FS(i,j)=cq(i)*q(i)*(aq(i)+cq(i)/2)/l; end end end

%???????????????????????? m=zeros(1,100); v=zeros(1,100); fs=zeros(1,100); for j=1:1:100

for i=1:1:n1+n2+n3 m(j)=m(j)+ M(i,j); v(j)=v(j)+ V(i,j); fs(j)=fs(j)+ FS(i,j); end end

%?????????????? j=1:1:100; x1=j*l/100; y1=m(j);

area(handles.axes1,x1,y1);

h_t1=title(handles.axes1,'弯矩图'); %???????????ú???? j=1:1:100; x2=j*l/100; y2=v(j)*1e3;

area(handles.axes2,x2,y2);

第 41 页

哈尔滨工业大学 机电工程学院 材料力学上机电算作业

h_t1=title(handles.axes2,'挠度图'); %?????????????? j=1:1:100; x3=j*l/100; y3=fs(j);

area(handles.axes3,x3,y3);

h_t1=title(handles.axes3,'剪力图'); Mmax=abs(y1); vmax=abs(y2) Fmax=abs(y3) Mmax1=max(Mmax) vmax1=max(vmax) Fmax1=max(Fmax)

set(handles.edit30,'string',num2str(Mmax1)); set(handles.edit31,'string',num2str(vmax1)); set(handles.edit32,'string',num2str(Fmax1)); id1=find(Mmax==Mmax1); xm1=x1(id1)

id2=find(vmax==vmax1); xm2=x2(id2)

id3=find(Fmax==Fmax1); xm3=x3(id3)

set(handles.edit33,'string',num2str(xm1)); set(handles.edit34,'string',num2str(xm2)); set(handles.edit35,'string',num2str(xm3));

第 42 页

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

Top