编写MATLAB函数,在给定电流和所有必要参数作为输入时计算导体的温度

时间:2015-11-01 19:41:01

标签: matlab

h = 11;                 
D = 0.02614;                                     
Tinfinity =302 ;         
sigma = 5.67*(10^-8);  %Variables
epsilon = 0.3;          
alpha = 0.6;           
Gs = 1200;              
R = 0.00007;     


for I=1:1:720
pF1=@(T) h.*pi*D.*(T-Tinfinity)+sigma.*epsilon.*pi*D.*((T.^4)-     (Tinfinity.^4))-alpha.*D.*Gs-(I.^2)*R;
T(I) = fzero(pF1,0); %T is temperature and I is current

end
plot (I,T)      %I cannot get it to plot a graph
xlabel('Current ');             
ylabel('Temperature ');

%我的问题是,除了T,温度

之外,我无法对所有变量进行图形化

1 个答案:

答案 0 :(得分:1)

我对与I vector和looping相关的代码进行了一些更改。请尝试以下代码:

h = 11;                 
D = 0.02614;                                     
Tinfinity =302 ;         
sigma = 5.67*(10^-8);  %Variables
epsilon = 0.3;          
alpha = 0.6;           
Gs = 1200;              
R = 0.00007;     

II  = [1: 1: 720]  ;
for I=1:length (II)
pF1=@(T) h.*pi*D.*(T-Tinfinity)+sigma.*epsilon.*pi*D.*((T.^4)-(Tinfinity.^4))-alpha.*D.*Gs-(I.^2)*R;
T(I) = fzero(pF1,0); %T is temperature and I is current

end
plot (II,T)      %I cannot get it to plot a graph
xlabel('Current ');             
ylabel('Temperature ');

在你的代码中我循环变量并且它保持循环的最终值720.但是,你试图绘制T Vs然后T的所有值都绘制了单个I值。