1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > matlab 桥梁跨径组合问题GUI图形界面完成

matlab 桥梁跨径组合问题GUI图形界面完成

时间:2023-12-18 11:23:17

相关推荐

matlab 桥梁跨径组合问题GUI图形界面完成

利用上一次的源代码进行的简单界面设计 下面是效果图

接下来是图形代码

function varargout = bijiaoGUI(varargin)% BIJIAOGUI MATLAB code for bijiaoGUI.fig%BIJIAOGUI, by itself, creates a new BIJIAOGUI or raises the existing%singleton*.%%H = BIJIAOGUI returns the handle to a new BIJIAOGUI or the handle to%the existing singleton*.%%BIJIAOGUI('CALLBACK',hObject,eventData,handles,...) calls the local%function named CALLBACK in BIJIAOGUI.M with the given input arguments.%%BIJIAOGUI('Property','Value',...) creates a new BIJIAOGUI or raises the%existing singleton*. Starting from the left, property value pairs are%applied to the GUI before bijiaoGUI_OpeningFcn gets called. An%unrecognized property name or invalid value makes property application%stop. All inputs are passed to bijiaoGUI_OpeningFcn via varargin.%%*See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one%instance to run (singleton)".%% See also: GUIDE, GUIDATA, GUIHANDLES% Edit the above text to modify the response to help bijiaoGUI% Last Modified by GUIDE v2.5 13-Jul- 23:16:27% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @bijiaoGUI_OpeningFcn, ...'gui_OutputFcn', @bijiaoGUI_OutputFcn, ...'gui_LayoutFcn', [] , ...'gui_Callback', []);if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});endif nargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});elsegui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before bijiaoGUI is made visible.function bijiaoGUI_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 bijiaoGUI (see VARARGIN)set(handles.text1,'visible','off')set(handles.text2,'visible','off')set(handles.text4,'visible','off')% Choose default command line output for bijiaoGUIhandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes bijiaoGUI wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = bijiaoGUI_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)% Get default command line output from handles structurevarargout{1} = handles.output;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)% 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% --- 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)str1=get(handles.edit1,'String');KJ=str2num(str1);%x存放data%寻找函数,找到所有整数的组合%53为一跨长度可任意取值,一般跨径为40~60m%此函数仅考虑纵向分割%让跨径参数化%K跨选择方程YKJ=0.2*KJ-1%四舍五入YY=round(YKJ)data = [];for k=3:13for b=0:0.5:5a=(KJ-2*b)/k;if rem(a,1) ~= 0a;continueelsea;b;k;x=[a,b,k];data = [data;x];endendenddata%筛选函数,选出更适合的组合index=[];A=data(:,1);for i=1:length(A)if A(i)>=3 & A(i)<=7index=[index;i];elsecontinueendendindexdataX=[];for i=1:length(index)aa=data(index(i),:);dataX=[dataX;aa];enddataX%平均性检测,选择比较平均的几组数据Z=ones(1,size(dataX,1));AA=5;BB=2.5;KK=YY;for i=1:size(dataX,1)Z(i)=abs(dataX(i,1)-AA)/AA+abs(dataX(i,2)-BB)/BB+abs(dataX(i,3)-KK)/KK;endZ;[F,ix]=sort(Z,'descend');ixx=ix(1,fix(size(dataX,1)/2):size(dataX,1));%将ixx倒叙ixxx=fliplr(ixx);dataXX=[];for i=1:length(ixxx)p=dataX(ixxx(i),:);dataXX=[dataXX;p];enddataXX;A2=[]%对a打分for i=1:size(dataXX,1)A2(i)=abs(dataXX(i,1)-5)/5;endA2ta=tabulate(A2(:))NZ=size(ta,1)AAA=[];for i =1:size(ta,1)for j=1:length(A2)if A2(j) == ta(i,1)AAA(j)=1-(i-1)*(1/NZ);endendendAAA;B2=[];BBB=[];%对b打分for i=1:size(dataXX,1)B2(i)=abs(dataXX(i,2)-2.5)/2.5;endB2;ta2=tabulate(B2(:))for i =1:size(ta2,1)for j=1:length(B2)if B2(j) == ta2(i,1)BBB(j)=1-(i-1)*(1/NZ);endendendBBB;%对c打分K2=[]KKK=[]for i=1:size(dataXX,1)K2(i)=abs(dataXX(i,3)-YY)/YY;endK2ta3=tabulate(K2(:))for i =1:size(ta3,1)for j=1:length(K2)if K2(j) == ta3(i,1)KKK(j)=1-(i-1)*(1/NZ);endendendKKK%层次分析法%为设置判断矩阵%一致性指标查表,3阶Ri为0.58%原则上CR小于0.1时,可以考虑P=[1,5,3;1/5,1,1/3;1/3,3,1;];n1=length(P);ri=[0,0,0.58,0.9,1.12];[x,y]=eig(P);lamda=max(diag(y))cr0=(lamda-n1)/(n1-1)/ri(n1)ZZJG=[];if cr0<0.1disp('一致性检测通过')%归一化处理,得出权重系数for i =1:n1for j=1:n1PP(i,j)=P(i,j)/sum(sum(P));endendPPH=sum(PP,2);for i =1:length(H)W(i)=H(i)/sum(H);end %权重值Wx_new=[AAA;BBB;KKK];PJZ=W*x_new[Z,xidx]=sort(PJZ,'descend');xidxfor i=1:length(xidx)ZZJG=[ZZJG;dataXX(xidx(i),:)];endZZJG2=ZZJG(2:size(ZZJG,1),:);endset(handles.text1,'visible','on')set(handles.text2,'visible','on')set(handles.text4,'visible','on')set(handles.text1,'string','跨径推荐组合为:','FontSize',12);set(handles.text2, 'string', num2str(ZZJG),'FontSize',12);set(handles.text4,'string','分段长度 两侧长度 跨数','FontSize',12);

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。