当前位置:网站首页>2021 mathematical modeling group B code
2021 mathematical modeling group B code
2022-07-28 22:15:00 【sparename】
First question
clc
clear
%%
data=xlsread(' The attachment 1.xlsx');% Load data
load('zu.mat');% Load data 21 Group
for i=1:length(unique(zu))%i from 1:21
A(i)={
data(find(zu==i),:)}% Define a tuple , Divide into 21 Group
end
%%
for i=1:5
for j=1:4
subplot(4,5,(i-1)*4+j);%4*5 Of diamonds , stay 4*5 Where is the square
B=A{
1,(i-1)*4+j};% extract A In the 4*5 Data of each position of the block
plot(B(:,1),B(:,2),B(:,1),B(:,4));%B pass the civil examinations 1 Column , The first 2 Column drawing ,B pass the civil examinations 1 Column , The first 4 Column drawing
hold on
xlabel(' temperature /C');%x label
ylabel(' percentage /%');%y label
title(sprintf(' Catalyst combination %i\n',(i-1)*4+j));% Each combination of titles
end
end
%%
legend(' Ethanol conversion ','C4 Olefin selectivity '); % Mark in the upper right corner
%%
% Draw pictures for each group
figure(2)% Create a new window
for i=1:21
B=A{
1,i};% extract A Each group of data in
plot(B(:,1),B(:,2));
[b,bint,r,rint,stats]=regress(n',t); hold on end %% % Each group of annotations for i=1:21 str{i}=[' Catalyst combination ',num2str(i)]; end legend(str); %% title(' Temperature dependence of ethanol conversion of different combinations '); xlabel(' temperature /C');%x label ylabel(' percentage /%');%y label %% % Draw pictures for each group figure(3)% Create a new window for i=1:21 B=A{1,i};% extract A Each group of data in plot(B(:,1),B(:,4)); hold on end %% % Each group of annotations for i=1:21 str{i}=[' Catalyst combination ',num2str(i)]; end legend(str); %% title(' Different combinations C4 Variation diagram of olefin selectivity with temperature '); xlabel(' temperature /C');%x label ylabel(' percentage /%');%y label
%%
% Ethanol conversion
x=[1:21];
y=[250,275,300,325,350,400,450];% The most temperature column
for i=1:length(x)
for j=1:length(y)
B=A{
1,i};% extract A in 21 Groups of data
if j<=length(B(:,1))% If 21 Second in group 1 Column temperature column is less than y
Z(i,j)=B(j,2);% Direct assignment equals B pass the civil examinations 2 Column ethanol conversion
else
Z(i,j)=0;% Longer than y
end
end
end
% cftool
%%
% C4 Olefin selectivity
x=[1:21];
y=[250,275,300,325,350,400,450];% The most temperature column
for i=1:length(x)
for j=1:length(y)
B=A{
1,i};% extract A in 21 Groups of data
if j<=length(B(:,1))% If 21 Second in group 1 Column temperature column is less than y
Z(i,j)=B(j,4);% Direct assignment equals B pass the civil examinations 4 Column C4 Olefin selectivity
else
Z(i,j)=0;% Longer than y
end
end
end
cftool
Second questions
clc
clear
%%
data=xlsread(" The attachment 2.xlsx")% Load data
for i=1:7
% Draw the relationship graph between the time column and each column
subplot(2,4,i)
plot(data(:,1),data(:,i+1));
switch(i)
case 1
xlabel(' Time /min');%x label
ylabel(' Ethanol conversion /%');%y label
title(sprintf(' Combination of time and ethanol conversion '));% Each combination of titles
case 2
xlabel(' Time /min');%x label
ylabel(' Ethylene selectivity /%');%y label
title(sprintf(' Time and ethylene selective combination '));% Each combination of titles
case 3
xlabel(' Time /min');%x label
ylabel('C4 Olefin selectivity /%');%y label
title(sprintf(' Time and C4 Olefin selective combination '));% Each combination of titles
case 4
xlabel(' Time /min');%x label
ylabel(' Acetaldehyde selectivity /%');%y label
title(sprintf(' Selective combination of time and acetaldehyde '));% Each combination of titles
case 5
xlabel(' Time /min');%x label
ylabel(' Carbon number is 4-12 fatty alcohol /%');%y label
title(sprintf(' The time and carbon number are 4-12 Fatty alcohol combination '));% Each combination of titles
case 6
xlabel(' Time /min');%x label
ylabel(' Methylbenzaldehyde and methylbenzyl alcohol /%');%y label
23
title(sprintf(' Time combined with methylbenzaldehyde and methylbenzyl alcohol '));% Each combination of titles
otherwise
xlabel(' Time /min');%x label
ylabel(' other /%');%y label
title(sprintf(' Time and other combinations '));% Each combination of titles
end
end
Genetic algorithm to find the optimal solution
clc,clear
options=gaoptimset('Generations',800,'StallGenLimit',300,'PopInitRange',[0.25 0.15 0.24 5 250;7.5 3.05 1.5 300 400],'PlotFcns',@gaplotbestf);
[x,f]=ga(@SA,5,options)
function f=SA(x)
if (x(1)>7.5|x(1)<0.25|x(2)>3.05|x(2)<0.15|x(3)>1.5|x(3)<0.24627|x(4)>300|x(4)<5|x(5)>400|x(5)<250)% Variable range
f=0; %s Fitness
else
a=(-41.909616+12.75438*x(3)+0.108627*x(4)+0.00052319939932*(x(5)^2)-8.519519*(x(2)/x(3)));
b=(-20.530653-3.239872.*x(1)+2.892962.*x(2)+0.086185*x(3)*x(4)+0.0002875058634*(x(5)^2));
f=-a*b; % Because only the minimum value can be found , Add one more - Reverse the sign to find the maximum
end
end
边栏推荐
- Differences of display values
- Aimbetter insight into your database, DPM and APM solutions
- How many tips do you know about using mock technology to help improve test efficiency?
- Esp8266 Arduino programming example - deep sleep and wake up
- Which brand is the best and most cost-effective open headset
- 39. 组合总和
- kubevela插件addons下载地址
- 罗克韦尔AB PLC RSLogix数字量IO模块基本介绍
- Bugku,Web:都过滤了
- Learn kotlin - extension function
猜你喜欢
随机推荐
ESP8266-Arduino编程实例-深度休眠与唤醒
内网渗透学习(三)域横向移动——计划任务
KubeEdge发布云原生边缘计算威胁模型及安全防护技术白皮书
KubeVela 1.4.x 官方文档
Oracle, SQL Foundation
数据可视化新闻,不一样的新闻报道形式
HCIP(8)
40. Combined sum II
腾讯云数据库负责人林晓斌借一亿元炒股?知情人士:金额不实
Future trend of defi in bear market
Oracle built-in functions
HCIP(15)
hcip实验(14)
表单验证和级联下拉列表(多种实现)
罗克韦尔AB PLC RSLogix数字量IO模块基本介绍
HCIP(11)
Learn kotlin - extension function
ssh 免密码登录
2021数学建模B组练习
Lt7911d type-c/dp to Mipi scheme is mature and can provide technical support









