Plotting 2d data
1 回表示 (過去 30 日間)
古いコメントを表示
Haven't touched Matlab in over two years, trying to create a graph plotting my answers. I'm getting an error "Index exceeds the number of array elements (1)."
%loop for thickness
for i = 3 : 1 : 10
%loop for number of fins
for j = 8 : 1 : 12
m(i) = sqrt((2*ho)/(k*t(i)/1000)); % m^-1
At(i,j) = fins(j)*Af+((2*pi*r2)-(fins(j)*t(i)/1000)); %m
n_o(i,j) = 1-(((fins(j)*Af)/At(i,j))*(1-(tanh(m(i)*(r3-r2))/(m(i)*(r3-r2)))));
R_to(i,j) = 1/(n_o(i,j)*ho*At(i,j)); % m*K/W
R_t(i,j) = R_conv + R_cond +R_to(i,j); % m*K/W
q(i,j) = (delta_T)/(R_t(i,j)); % W/m
plot(j,q(i,j),'b-',linewidth',2);
hold on
end
end
plot(fins,q,'r.','markersize',20,'linewidth',2);
set(gca,'fontsize',16,'fontweight','bold')
title('Heat Rate increase as fins and thickness increases');
xlabel('Number of Fins','fontsize',16);
ylabel('Heat Rate (W)','fontsize',16);
0 件のコメント
採用された回答
Walter Roberson
2019 年 4 月 21 日
t = 0.003 is a scalar, but you index t(i)
Caution: your i and j are scalars, so plot(j, q(i,j), 'b-') is going to try to plot a single point. plot() only ever draws a line you pass it two adjacent finite values in a single call. Your plot() call is not going to plot anything. If you were to alter the 'b-' to 'b*-' then it would at least place markers at the single points that it draws.
3 件のコメント
Walter Roberson
2019 年 4 月 21 日
Parts of the code have mysteriously vanished and due to an allergy flare I don't seem to have successfully memorized it before it changed.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Title についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!