for T_cond = [-100:20:0]
for T_cond = 273.15+T_cond
.
.
.
etc..
m_wf = m_LNG*(h_5s-h_5)/(h_4s-h_4);
m_wf = m_wf + 0;
E_th = (h_2-h_3-h_1+h_4)/(h_2-h_1);
E_th = (E_th + 0)*100;
disp(['E=',num2str(E_th),'%'])
disp(['m=',num2str(m_wf),'kg/s'])
end
end
plot(T_cond,m_wf)
plot(T_cond,E_th)
I want to plot all results in for loop.. but I'm beginner..so It's so hard to me.. Actually This is the first time in my life..help me please

1 commentaire

KSSV
KSSV le 1 Nov 2018
YOu need to reconsider your code..you should not use same index T_cond for the loops.

Connectez-vous pour commenter.

 Réponse acceptée

KSSV
KSSV le 1 Nov 2018
YOu should do the following to plot figure in a loop.
%%In aloop (not suggested)
figure
hold on
for i = 1:10
plot(rand,rand,'.r')
end
%%suggested and effective
x = zeros([],1) ;
y = zeros([],1) ;
for i = 1:10
x(i) = rand ; % x,y are calculated inside loop
y(i) = rand ;
end
figure
plot(x,y,'-.')

4 commentaires

Jungmin Lee
Jungmin Lee le 1 Nov 2018
Modifié(e) : Jungmin Lee le 1 Nov 2018
T_cond = zeros([],1);
m_wf = zeros([],1);
E_th = zeros([],1);
for i = -100:20:0
T_cond(i) = i + 273.15;
m_wf(i) = m_LNG*(h_5s-h_5)/(h_4s-h_4);
E_th = (h_2-h_3-h_1+h_4)/(h_2-h_1);
E_th(i) = (E_th + 0)*100;
disp(['E=',num2str(E_th),'%'])
disp(['m=',num2str(m_wf),'kg/s'])
end
I'm sorry It's not working..What's the problem with me..?
No negative indices in MATLAB.
T_cond = zeros([],1);
m_wf = zeros([],1);
E_th = zeros([],1);
T = -100:20:0 ;
for i = 1:length(T)
T_cond(i) = T(i) + 273.15;
P_eva = refpropm('P','T',T_eva,'Q',0,WF);
h_4 = refpropm('H','T',T_cond,'Q',0,WF);
m_wf(i) = m_LNG*(h_5s-h_5)/(h_4s-h_4);
E_th = (h_2-h_3-h_1+h_4)/(h_2-h_1);
E_th(i) = (E_th + 0)*100;
disp(['E=',num2str(E_th),'%'])
disp(['m=',num2str(m_wf),'kg/s'])
end
Jungmin Lee
Jungmin Lee le 1 Nov 2018
Modifié(e) : Jungmin Lee le 1 Nov 2018
oh you're so kind a lot of thanks you so much,,but I have another error..sorry to bother you
Input #3 is not a scalar.
KSSV
KSSV le 1 Nov 2018
I should know the function refpropm with the inputs given. Knowing that only I we can help you.

Connectez-vous pour commenter.

Plus de réponses (1)

plot(T_cond,m_wf)
hold on
plot(T_cond,E_th)
Should be inside loop

Catégories

En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by