我製作了一個代碼,它使用for循環來確定ti和t的值。當我繪製變量時,我將所有點都作爲散點圖,我想繪製一條線性最好的線作爲數據。但是,數據正在繪製,因爲每個點都是他們自己的數據集。有沒有辦法來收集數據到一個矩陣來繪製線性圖在Matlab中使用For循環繪圖
clc
清除所有 關閉所有
%Heat Transfer
% I is the current passing through the conductor
I=475;
% h is the coeffcient of convective heat [W/ m^2*K] transfer
h=10;
% D is the diameter of the conductor [m]
D=0.02364;
% o is the stefan-boltzman constant [W/m^2*K^4]
o= 5.67*(10^-8);
% e is the emissivity coeffcient of the conductor
e= 0.2;
% u is the absorbivity coeffcient of the conductor
u= 0.5;
% G is the solar irradiance
G= 1200;
% r is the resistivity of the conductor per metre
r= 0.0000864;
%Qs is the Solar irradiation into the conductor
%Qs=u*D*G;
%Qg is the columbic losses generated internally
%Qg=i^2*r;
% Qc is the convective energy flowing out of the conductor
%Qc=h*pi*D*(t-ti);
% Qr is the radiative energy out of the conductor
% Qr=o*e*D*(t^4 - ti^4);
% ti is the ambient temperature [K]
% t is the temperature of the conductor [K]
for ti= 213:1:313
a= @(t) (h*pi*D*(t-ti))+(o*e*D*pi*(t^4 - ti^4))-((u*D*G)+(I^2*r));
t= fzero(a,0);
%fprintf('The temperature of the conductor is: %.2f K when the outside temperature is %g K \n',t,ti)
hold on
end
%I want to plot (ti,t)
您應該包含您擁有的代碼(最好是[最小示例](http://stackoverflow.com/help/mcve))。它可以幫助澄清你的意圖和你遇到的任何問題。 – 2014-10-11 04:51:48
我現在可以看一下嗎? – 2014-10-14 23:24:18