当前位置:网站首页>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
边栏推荐
- 第 7 篇:绘制旋转立方体
- Data visualization news, different forms of news reports
- DHCP and PPPoE protocols and packet capture analysis
- Matlab from introduction to mastery Chapter 1 Introduction to matlab
- Ukrainian officials: half of Ukrainian agricultural products are exported through the Danube port
- Miscellaneous records of powersploit, evaluation, weevery and other tools in Kali
- Apifox: satisfy all your fantasies about API
- Explain the remote debugging program of visual studio 2015 in LAN
- [hero planet July training leetcode problem solving daily] dynamic planning on the 28th
- The person in charge of Tencent cloud database borrowed 100 million yuan to speculate in stocks? Insider: the amount is not true
猜你喜欢
![[NLP] generate word cloud](/img/c4/4e9707bba58732a90d1c30312719a3.png)
[NLP] generate word cloud

局域网添加DNS服务器进行域名解析

hcip实验(15)

【机器学习】朴素贝叶斯对文本分类--对人名国别分类

Learning notes and summary of C language programming specification

Make trouble fishing day by day

Which brand is the best and most cost-effective open headset
![Introduction to C language [detailed]](/img/ac/9ba2e298faabd8dc4c76575ea182d1.png)
Introduction to C language [detailed]

字节一面:TCP 和 UDP 可以使用同一个端口吗?

记录Flutter解决A RenderFlex overflowed by 7.3 pixels on the bottom溢出问题
随机推荐
Esp8266 Arduino programming example - SPIFs and data upload (Arduino IDE and platformio IDE)
Aimbetter insight into your database, DPM and APM solutions
HCIP(13)
ESP8266-Arduino编程实例-深度休眠与唤醒
HCIP(9)
Ukrainian officials: half of Ukrainian agricultural products are exported through the Danube port
什么是质因数,质因数(素因数或质因子)在数论里是指能整除给定正整数的质数
Using Baidu easydl to realize chef hat recognition of bright kitchen and stove
Part 8: creating camera classes
CDN工作原理
小程序 canvas 生成海报
DHCP and PPPoE protocols and packet capture analysis
LVS+KeepAlived高可用部署实战应用
The difference between get and post
Intranet penetration learning (III) horizontal movement of domain - planning tasks
内网渗透学习(三)域横向移动——计划任务
array_diff_assoc 元素是数组时不比较数组值的办法
hcip实验(12)
HCIP(8)
How to establish a decentralized community in Web3