Plotting grapf of heat exchanger
1 view (last 30 days)
Show older comments
I'm trying to plot the grapf of a heat exchanger, I already calculated the values but have struggle in plotting it.
The simple form of my code is this:
clear all
clc
c=[];
Teth_in=195; %[K]
Tgas_out=230; %[K]
ms_gas=0.342; %[kg/s]
ms_eth=0.412; %[kg/s]
cp_gas=3600;
cp_eth=2440;
dia=25*(10^-3);
for Tgas_in=230:1:290 %[K]
Q_in=ms_gas*cp_gas*(Tgas_out-Tgas_in);
Teth_out=-Q_in/(ms_eth*cp_eth)+Teth_in;
Q_out=ms_eth*cp_eth*(Teth_in-Teth_out);
%% Logarithmischer Temperaturdifferenz in Gegenstrom Wärmetauscher:
delta_T1 = Tgas_in - Teth_out; % [K]
delta_T2 = Tgas_out - Teth_in; % [K]
delta_Tm = (delta_T1 - delta_T2) / (log10(delta_T1/delta_T2)/(log10(exp(1)))); % [K]
U=450;
Lx=-Q_in/(U*pi*dia*delta_Tm);
c=[c; Lx delta_Tm Teth_out Tgas_in];
end
plot(c(:,1),c(:,3))
hold on
plot(c(:,1),c(:,4))
grid on
xlabel('Länge [m]')
ylabel('Temperatur [K]')
title('Wärmetauscher Kühlungsverlauf')
legend('Ethanol','Erdgas','location','northwest')
The grapf should be like this:
the grapf i plotted is this:
The problem is that the Lx value is being taken wrong. For example for the red curve , when Lx is 0 then the y-value should be 290, and when Lx is 75 then the y-value should be 230. At the end should get a grapf like the first grapf i added. I hope someone can help me
0 Comments
Answers (1)
Arthi Sathyamurthi
on 24 May 2021
The plot(c(:,1), c(:,3)) considers the first value of c(:,1) as x coordinate and first value of c(:,3) as the y coordinate and increments in order for both x and y coordinates. Your values in c(:,3) has the values inverted. Use the function flipud to flip the rows in the up-down direction and plot the same.
The code snippet would be
plot(c(:,1),flipud(c(:,3)))
hold on
plot(c(:,1),flipud(c(:,4)))
0 Comments
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!