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

2023-10-13 19:40

本文主要是介绍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-2018 23:16:27% Begin initialization code - DO NOT EDIT
gui_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 bijiaoGUI
handles.output = hObject;% Update handles structure
guidata(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 structure
varargout{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];endend
end
data%筛选函数,选出更适合的组合
index=[];
A=data(:,1);
for i=1:length(A)if A(i)>=3 & A(i)<=7index=[index;i];elsecontinueend
end
indexdataX=[];
for i=1:length(index)aa=data(index(i),:);dataX=[dataX;aa];
end
dataX%平均性检测,选择比较平均的几组数据
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;
end
Z;[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];
end
dataXX;
A2=[]
%对a打分
for i=1:size(dataXX,1)A2(i)=abs(dataXX(i,1)-5)/5;
end
A2
ta=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);endend
end
AAA;
B2=[];
BBB=[];
%对b打分
for i=1:size(dataXX,1)B2(i)=abs(dataXX(i,2)-2.5)/2.5;
end
B2;
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);endend
end
BBB;
%对c打分
K2=[]
KKK=[]
for i=1:size(dataXX,1)K2(i)=abs(dataXX(i,3)-YY)/YY;
end
K2
ta3=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);endend
end
KKK%层次分析法
%为设置判断矩阵
%一致性指标查表,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);

这篇关于matlab 桥梁跨径组合问题GUI图形界面完成的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/205433

相关文章

springboot3.4和mybatis plus的版本问题的解决

《springboot3.4和mybatisplus的版本问题的解决》本文主要介绍了springboot3.4和mybatisplus的版本问题的解决,主要由于SpringBoot3.4与MyBat... 报错1:spring-boot-starter/3.4.0/spring-boot-starter-

在 Spring Boot 中使用异步线程时的 HttpServletRequest 复用问题记录

《在SpringBoot中使用异步线程时的HttpServletRequest复用问题记录》文章讨论了在SpringBoot中使用异步线程时,由于HttpServletRequest复用导致... 目录一、问题描述:异步线程操作导致请求复用时 Cookie 解析失败1. 场景背景2. 问题根源二、问题详细分

解读为什么@Autowired在属性上被警告,在setter方法上不被警告问题

《解读为什么@Autowired在属性上被警告,在setter方法上不被警告问题》在Spring开发中,@Autowired注解常用于实现依赖注入,它可以应用于类的属性、构造器或setter方法上,然... 目录1. 为什么 @Autowired 在属性上被警告?1.1 隐式依赖注入1.2 IDE 的警告:

解决java.lang.NullPointerException问题(空指针异常)

《解决java.lang.NullPointerException问题(空指针异常)》本文详细介绍了Java中的NullPointerException异常及其常见原因,包括对象引用为null、数组元... 目录Java.lang.NullPointerException(空指针异常)NullPointer

Android开发中gradle下载缓慢的问题级解决方法

《Android开发中gradle下载缓慢的问题级解决方法》本文介绍了解决Android开发中Gradle下载缓慢问题的几种方法,本文给大家介绍的非常详细,感兴趣的朋友跟随小编一起看看吧... 目录一、网络环境优化二、Gradle版本与配置优化三、其他优化措施针对android开发中Gradle下载缓慢的问

关于Nginx跨域问题及解决方案(CORS)

《关于Nginx跨域问题及解决方案(CORS)》文章主要介绍了跨域资源共享(CORS)机制及其在现代Web开发中的重要性,通过Nginx,可以简单地解决跨域问题,适合新手学习和应用,文章详细讲解了CO... 目录一、概述二、什么是 CORS?三、常见的跨域场景四、Nginx 如何解决 CORS 问题?五、基

MySQL安装时initializing database失败的问题解决

《MySQL安装时initializingdatabase失败的问题解决》本文主要介绍了MySQL安装时initializingdatabase失败的问题解决,文中通过图文介绍的非常详细,对大家的学... 目录问题页面:解决方法:问题页面:解决方法:1.勾选红框中的选项:2.将下图红框中全部改为英

Nginx启动失败:端口80被占用问题的解决方案

《Nginx启动失败:端口80被占用问题的解决方案》在Linux服务器上部署Nginx时,可能会遇到Nginx启动失败的情况,尤其是错误提示bind()to0.0.0.0:80failed,这种问题通... 目录引言问题描述问题分析解决方案1. 检查占用端口 80 的进程使用 netstat 命令使用 ss

mybatis和mybatis-plus设置值为null不起作用问题及解决

《mybatis和mybatis-plus设置值为null不起作用问题及解决》Mybatis-Plus的FieldStrategy主要用于控制新增、更新和查询时对空值的处理策略,通过配置不同的策略类型... 目录MyBATis-plusFieldStrategy作用FieldStrategy类型每种策略的作

linux下多个硬盘划分到同一挂载点问题

《linux下多个硬盘划分到同一挂载点问题》在Linux系统中,将多个硬盘划分到同一挂载点需要通过逻辑卷管理(LVM)来实现,首先,需要将物理存储设备(如硬盘分区)创建为物理卷,然后,将这些物理卷组成... 目录linux下多个硬盘划分到同一挂载点需要明确的几个概念硬盘插上默认的是非lvm总结Linux下多