# Trying to code from Polymath

3 visualizzazioni (ultimi 30 giorni)
Sagarika Bhagat il 29 Nov 2021
Risposto: Rishabh Singh il 6 Dic 2021
Im supposed to turn this Polymath code into a Matlab code but Im not sure how. Please help. Its supposed to use an ode solver and a graph
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Rishabh Singh il 6 Dic 2021
Hi Sagarika,
Below is the code for MATLAB Version.
% Initial conditions
X0 = 0;
T0 = 450;
Ta0 = 323;
IC = [X0 T0 Ta0];
% W range
Wspan = [0 50];
% Call ode solver
[W, CT] = ode45(@fn, Wspan, IC);
% Extract parameters
X = CT(:,1);
T = CT(:,2);
Ta = CT(:,3);
% Plot graphs
figure
plot(W,X,W,T,W,Ta),grid
xlabel('W'),ylabel('X.T.Ta')
legend('X','T','Ta')
figure
plot(W,T),grid
xlabel('W'),ylabel('T')
% ODE function
function dCTdW = fn(~,CT)
% Data
V0 = 20;
T0 = 450;
Uabyrho = 0.08;
CPc = 5000;
mc=0.2;
P0 = 1013250;
% Extract parameters
X = CT(1);
T = CT(2);
Ta = CT(3);
%supporting functions
k = 0.133*exp(31400/8.314*(1/T0 - 1/T));
CA0 = P0/(8.314*T0);
CA = CA0*(1-X)*(T0/T)/(1+X);
rA = -k*CA;
% odes
dCTdW = [(k*(1-X)*T0)/(V0*(1+X)*T);
(Uabyrho*(Ta-T)+rA*20000)/(V0*CA*40);
(Uabyrho*(T-Ta)/(mc*CPc))];
end
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Ordinary Differential Equations in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by