当前位置:网站首页>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
边栏推荐
- 局域网添加DNS服务器进行域名解析
- Esp8266 Arduino programming example - timer and interrupt
- Esp8266 Arduino programming example - SPIFs and data upload (Arduino IDE and platformio IDE)
- Oracle triggers
- Ukrainian officials: half of Ukrainian agricultural products are exported through the Danube port
- Pyqt5 rapid development and actual combat 5.4 web page interaction
- 拥抱开源指南
- Principle of object. Prototype. ToString. Call()
- Clearing of applet component timer
- Summary of the use of hash table set and map when leetcode brushes questions
猜你喜欢

Record the fluent to solve the problem of a renderflex overflowed by 7.3 pixels on the bottom

Apifox: satisfy all your fantasies about API

Apifox:满足你对 Api 的所有幻想

Oracle, SQL Foundation
![[CS231N]Lecture_2:Image Classification pipelin](/img/4f/de56b071560ada746c587a9dbc5f02.jpg)
[CS231N]Lecture_2:Image Classification pipelin

HCIP第七次实验

Lt7911d type-c/dp to Mipi scheme is mature and can provide technical support

AimBetter洞察您的数据库,DPM 和 APM 解决方案

Brief introduction to PCB materials

How many tips do you know about using mock technology to help improve test efficiency?
随机推荐
搞事摸鱼一天有一天
Gateway technology of IOT technology stack
2021年数学建模B组代码
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
Hcip experiment (15)
39. 组合总和
Clearing of applet component timer
hcip实验(14)
Kubevera plug-in addons download address
04. Default value of toref
小程序 canvas 生成海报
In Kingbase, the user is specified to search the schema by default, or the user cannot use the function under the public schema
熊市下 DeFi 的未来趋势
HCIP(11)
Hcip seventh experiment
The applet listens for the target node to appear on the screen
hcip实验(15)
Basic introduction of Rockwell AB PLC rslogix digital quantity IO module
[CS231N]Lecture_2:Image Classification pipelin
HCIP(10)