当前位置:网站首页>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
边栏推荐
- ESP8266-Arduino编程实例-深度休眠与唤醒
- Hcip seventh experiment
- Byte side: can TCP and UDP use the same port?
- Brief introduction to PCB materials
- HYDAC overflow valve db08a-01-c-n-500v
- Openeuler embedded sig | distributed soft bus
- 腾讯云数据库负责人借了一亿元炒股?知情人士:金额不实
- HCIP(13)
- 【机器学习】朴素贝叶斯对文本分类--对人名国别分类
- array_ diff_ The method of not comparing array values when Assoc element is an array
猜你喜欢

Leetcode · 581. shortest unordered continuous subarray · double pointer

CDN working principle

Add DNS server to LAN for domain name resolution

Hcip experiment (15)

Data visualization news, different forms of news reports

Embrace open source guidelines

For the first time, Chinese scientists used DNA to construct convolutional artificial neural network, which can complete 32 types of molecular pattern recognition tasks, or be used for biomarker signa

管理区解耦架构见过吗?能帮客户搞定大难题的

记录Flutter解决A RenderFlex overflowed by 7.3 pixels on the bottom溢出问题

KubeVela 1.4.x 官方文档
随机推荐
SQL注入 Less38(堆叠注入)
数据可视化新闻,不一样的新闻报道形式
What is a prime factor? In number theory, a prime factor (prime factor or prime factor) refers to a prime number that can divide a given positive integer
Open earphone which air conduction earphone with good sound quality and recognized sound quality is recommended
Make trouble fishing day by day
HCIP(9)
【云原生之kubernetes】在kubernetes集群下的映射外部服务—Eendpoint
Learn kotlin - extension function
内网渗透学习(三)域横向移动——计划任务
Using Baidu easydl to realize chef hat recognition of bright kitchen and stove
Aimbetter insight into your database, DPM and APM solutions
ssh 免密码登录
Getting started with Oracle
行内元素和块级元素有什么区别?语义化作用
2021数学建模B组练习
Embrace open source guidelines
Oracle database objects
ESP8266-Arduino编程实例-深度休眠与唤醒
HCIP(11)
display 各值的区别