25 ビュー (過去 30 日間)
Sun Wook Han 2021 年 1 月 24 日
コメント済み: Mischa Kim 2021 年 1 月 25 日
The code below is how I got T1.
Now, I'd like to plot T1 vs T0(it was a fixed value 450).
What code should I input here?
I tried
T0 = linspace (273, 500);
plot (T0, y)
but it doesn't work
clc, clear all; close all;
syms T1
U = 8000; % cal/(min*C)
Cp0 = 50; % cal/(mol*C)
Fa0 = 80; % 80mol/min
E = 40000; % cal/mol
H = -7500; % cal/mol
t = 100; % min^-1
T0 = 450; % K
Ta = 300; % K
T2 = 350; % K
R = 1.987; % cal/(mol*K)
k2 = 6.6*10^-3; % min^-1
%Heat removed
k = U/(Cp0*Fa0);
Tc = (k*Ta+T0)/(1+k);
Rt = Cp0*(1+k)*(T1-Tc);
%Heat generated
k1 = k2*exp((E/R)*((1/T2)-(1/T1)));
Gt = -H*t*k1/(1+(t*k1));
y = vpasolve (Rt == Gt, T1)

サインインしてコメントする。

### 採用された回答

Walter Roberson 2021 年 1 月 24 日
For some T values, there are two solutions; which one you get depends upon the starting point for your search.
t0 = linspace(273, 500, 350);
nt = length(t0);
syms T1 T0 real
U = 8000; % cal/(min*C)
Cp0 = 50; % cal/(mol*C)
Fa0 = 80; % 80mol/min
E = 40000; % cal/mol
H = -7500; % cal/mol
t = 100; % min^-1
%T0 = 450; % K
Ta = 300; % K
T2 = 350; % K
R = 1.987; % cal/(mol*K)
k2 = 6.6*10^-3; % min^-1
%Heat removed
k = U/(Cp0*Fa0);
Tc = (k*Ta+T0)/(1+k);
Rt = Cp0*(1+k)*(T1-Tc);
%Heat generated
k1 = k2*exp((E/R)*((1/T2)-(1/T1)));
Gt = -H*t*k1/(1+(t*k1));
eqns = subs(Rt == Gt, T0, t0);
y = zeros(1, nt);
old = 200;
for K = 1 : nt
sol = double(vpasolve(eqns(K), T1, old));
if isempty(sol)
y(K) = nan;
else
y(K) = sol;
old = sol;
end
end
plot(t0, y, 'b-')
y1 = zeros(1, nt);
old = 500;
for K = 1 : nt
sol = double(vpasolve(eqns(K), T1, old));
if isempty(sol)
y1(K) = nan;
else
y1(K) = sol;
%old = sol;
end
end
plot(t0, y1, 'b-')
y2 = zeros(1, nt);
old = 350;
for K = 1 : nt
sol = double(vpasolve(eqns(K), T1, old));
if isempty(sol)
y2(K) = nan;
else
y2(K) = sol;
%old = sol;
end
end
plot(t0, y2, 'b-')

サインインしてコメントする。

### その他の回答 (1 件)

Mischa Kim 2021 年 1 月 24 日

plot(T0,y,'ro')
Since this is only one single data point it is hard to see in the plot, hence I change the color and shape.
##### 2 件のコメントなしを表示なしを非表示
Sun Wook Han 2021 年 1 月 24 日

How do I need to define T0?
I tried
T0 = linspace(273, 500)
plot (T0, y, 'ro')
but it doesn't work.
the error message says..
More equations than variables is only supported for
polynomial systems.
Error in sym/vpasolve (line 172)
sol =
eng.feval_internal('symobj::vpasolve',eqns,vars,X0);
Error in Untitled3 (line 28)
y = vpasolve (Rt == Gt, T1)
Mischa Kim 2021 年 1 月 25 日
I misinterpreted your question. Thanks, @Walter Roberson for providing an excellent answer.

サインインしてコメントする。

### カテゴリ

Help Center および File ExchangeGraphics についてさらに検索

### Community Treasure Hunt

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

Start Hunting!

Translated by