# optimizing the steady state temperature of an MSMPR

조회 수: 9(최근 30일)
Hi I'm a Chemical Engineering PhD student and I'm struggling with solving this problem.
The problem posed is to set the steady state temperature (temperature doesnt change with time) of the MSMPR (Mixed suspension mixed product removal). For a bit of background; it's a type of crystallisation process used in pharmaceutical processing.
Currently my code optimizes the temperature for each of the individual time steps of the dx/dt equations. As a result the temperature goes all over the place with respect to time.
I'm trying to get the code to optimize the size of crystals at the end of the process (@t=400) through altering the steady state temperature of the process.
the iteration process is as follows. there are other sacripts necessary to run the process however I have included the main bits of the iteration.
TC
_________________________________________________________________________________
function [f] = TempOptMSMPR_AvgCrystSize(x)
%Initial conditions
mui = 0;
Ci = 1; %kg/kgwater
x0 = [mui mui mui mui Ci];
tspan = [0, 400];
G = [];
for i=1:1:22; %XXX
T = x(i);
sol = ode45(@TempOptMSMPR_Mod, tspan, x0, [], T);
x0 = sol.y(:,end);
G = [G,sol.y(:,end)];
T=T-1;
end
%maximising Growth
f = G;
end
_________________________________________________________________________________
clear
close all
clc
%% Bounds
x0 = ;
lb = 293*ones(1,22); %XXXX
ub = 315*ones(1,22); %XXXX
nvars = 22; %difference between ub and lb constraints.
opts = optimoptions('fmincon','OptimalityTolerance',1e-10);
options = optimoptions('ga','PlotFcn', @gaplotbestf, 'Display', 'iter','Generations', 50, 'PopulationSize', 100);
fitfun = @TempOptMSMPR_Fitfun;
[x,fval] = ga(fitfun,nvars,[],[],[],[],lb,ub,[],options);

댓글을 달려면 로그인하십시오.

### 답변(1개)

Hiro 15 Dec 2020
I am not fully following your code but if you are using MATLAB R2020b (the latest), you should have "Task" in live editor.
From Task, you'll find the one for optimization, which surely helps you work on the optimization.
Actually there are two approaches for optimization in MATLAB:
1. solver based
2. problem based
I suppose what you used was (1) which is more difficult than (2) and you can easily set things up from TASK that uses (2) method.
##### 댓글 수: 1표시숨기기 없음
Timothy Campbell 15 Dec 2020
Many thanks, I shall try and give this a go.
TC

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!