Lines will not plot

조회 수: 5 (최근 30일)
darkphotonix
darkphotonix 2019년 6월 1일
답변: Star Strider 2019년 6월 1일
Good Afternoon
I am trying to plot multiple lines on a plot but, nothing is showing up. The variables are full of data, i have no clue where to go from here.
for L = [3 4 6] % m
if L == 3
w=1;
elseif L == 4
w=2;
elseif L == 6
w=3;
end
for i = 1 : 3
if i == 1
D(w,i) = 20 .* 10 .^ (-3); % m
elseif i == 2
D(w,i) = 30 .* 10 .^ (-3); % m
elseif i == 3
D(w,i) = 40 .* 10 .^ (-3); % m
end
for j = 1 : 3
if j == 1
T_inf(w,i,j) = 523.15;
sp_o(w,i,j) = sp_1;
k_o(w,i,j) = k_1;
Pr_o(w,i,j) = Pr_1;
elseif j == 2
T_inf(w,i,j) = 648.15;
sp_o(w,i,j) = sp_1;
k_o(w,i,j) = k_1;
Pr_o(w,i,j) = Pr_1;
elseif j == 3
T_inf(w,i,j) = 773.15;
sp_o(w,i,j) = sp_3;
k_o(w,i,j) = k_3;
Pr_o(w,i,j) = Pr_3;
end
%inside stuff
Re_Di(w,i,j) = 4 .* mf ./ ( pi .* D(w,i) .* mu );
NuDi_bar(w,i,j) = 0.023 .* Re_Di(w,i,j) .^ 0.8 .* Pr .^ 0.4 ;
hi_bar(w,i,j) = NuDi_bar(w,i,j) .* k_i ./ D(w,i) ;
figure(w)
for k = 1 : 1: 21
V(w,i,j,k) = k + 19;
Tm_i(w,i,j,k) = T_mi;
T_inf(w,i,j,k) = T_inf(w,i,j);
hi_bar(w,i,j,k) = hi_bar(w,i,j);
%outside stuff
Re_Do(w,i,j,k) = V(w,i,j,k) .* D(w,i) ./ sp_o(w,i,j) ;
NuDo_bar(w,i,j,k) = 0.3 + (0.62 .* Re_Do(w,i,j,k) .^ (1 ./ 2) .* Pr_o(w,i,j) .^ (1 ./ 3)) .* (1 + (Re_Do(w,i,j,k) ./ 282000) .^ (5 ./ 8)) .^ (4 ./ 5) ./ ((1 + (0.4 ./ Pr_o(w,i,j)) .^ (2 ./ 3)) .^ (1 ./4));
ho_bar(w,i,j,k) = NuDo_bar(w,i,j,k) .* k_o(w,i,j) ./ D(w,i);
%Finding which one is closest to Tm,o
U_bar(w,i,j,k) = ((1 ./ hi_bar(w,i,j,k)) + (1 ./ ho_bar(w,i,j,k))) .^ (-1);
e(w,i,j,k) = exp(-((pi .* D(w,i) .* L) ./ (mf .* cp)) .* U_bar(w,i,j,k));
T(w,i,j,k) = T_inf(w,i,j,k) - Tm_i(w,i,j,k);
Ti(w,i,j,k) = e(w,i,j,k) .* T(w,i,j,k);
Tm_o(w,i,j,k) = T_inf(w,i,j) - Ti(w,i,j,k);
%plot(V(w,i),Tm_o(w,i,j),'DisplayName',['D : ' num2str(D(w,i)) ' mm, T_inf : ' num2str(T_inf(w,i,j)) ' K'])
% if (T_mo - 0.1 < Tm_o(w,i,j,k)) && (T_mo + 0.1 > Tm_o(w,i,j,k))
% T_inf(w,i,j,k)
% Tm_o(w,i,j,k)
% V(w,i,j,k)
% D(w,i)
% L
%
% end
end
plot(V(w,i,j),Tm_o(w,i,j))
fprintf('%d\n',Tm_o(w,i,j));
end
end
%figure(w)
%plot(V(w,i,j,k),Tm_o(w,i,j,k)),
xlabel('Velocity(m/s)'), ylabel('Temp(k)'),
title(['Tmo vs. Velocity ', num2str(L),' m'])
hold on
end

답변 (1개)

Star Strider
Star Strider 2019년 6월 1일
You appear to be plotting points.
You need to call hold before the outermost loop:
figure
hold all
for L = [3 4 6] % m
then plot with a marker:
plot(V(w,i,j),Tm_o(w,i,j),'pg')
since the plot function plots lines between two points, in order of their appearance. If you are plotting fewer than two points at a time, you need to use a marker to see them.
Then call hold again after the end of the outermost loop:
end
hold off
to keep from plotting more points to the same axes.

카테고리

Help CenterFile Exchange에서 Image Analysis에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by