for loop for matrixes
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
i have a for loop inside a function and one of the input is a matrix of 44x12 (FC_in) the rest is just a value
i am doing sth work and i am getting error :
Error in Tabelle_43 (line 18)
[ f_pl ] = f_pl_Tabelle_43( T_43, V_H_WS, P_WP_KN, FC_in, FC ) ;
my inputs + function and below the code
T_43 = 1 ;
V_H_WS = 1 ;
FC = 2 ;
[ f_pl ] = f_pl_Tabelle_43( T_43, V_H_WS, P_WP_KN, FC_in, FC ) ;
function [ f_pl ] = f_pl_Tabelle_43( T_43, V_H_WS, P_WP_KN, FC_in, FC )
for i = 1 : 12
for j = 1 : length(FC_in)
if T_43 == 1
% Kleinflaeche Waermeabgabe V_H_WS = 0
if V_H_WS == 0 && FC_in(j,i) < 0.5 && FC_in(j,i) > 0
f_pl(j,i) = 0.588 ;
elseif V_H_WS == 0 && FC_in(j,i) >= 0.5 && FC_in(j,i) < 1
f_pl(j,i) = 0.588+0.822.*(FC-0.5) ;
% Kleinflaeche Waermeabgabe 0 < V_H_WS < 30*P_WP_KN
elseif V_H_WS > 0 && V_H_WS < 30*P_WP_KN && FC_in(j,i) < 0.5 && FC_in(j,i) > 0
f_pl(j,i) = 0.588+0.01*(V_H_WS./P_WP_KN) ;
elseif V_H_WS > 0 && V_H_WS < 30*P_WP_KN && FC_in(j,i) >= 0.5 && FC_in(j,i) < 1
f_pl(j,i) = 0.177+0.02*(V_H_WS./P_WP_KN)-0.02*FC ;
% Kleinflaeche Waermeabgabe V_H_WS >= 30*P_WP_KN
elseif V_H_WS >= 30*P_WP_KN && FC_in(j,i) < 0.5 && FC_in(j,i) > 0
f_pl(j,i) = 0.888 ;
elseif V_H_WS >= 30*P_WP_KN && FC_in(j,i) >= 0.5 && FC_in(j,i) < 1
f_pl(j,i) = 0.888+0.222*(FC-0.5) ;
else
error('error !')
end
elseif T_43 == 2
% Grossflaechige Waermeabgabe
if FC_in(j,i) < 0.5 && FC_in(j,i) > 0
f_pl(j,i) = 0.974;
elseif FC_in(j,i) >= 0.5 && FC_in(j,i) < 1
f_pl(j,i) = 0.974+0.05.*(FC-0.5);
else
error('error !')
end
else
error('error !')
end
end
end
end
댓글 수: 3
M
2020년 2월 20일
How are P_WP_KN, FC_in defined ?
What is the exact error message you get ?
I tried your code with the following initialization and got no errors:
T_43 = 1 ;
V_H_WS = 1 ;
FC = 2 ;
P_WP_KN = 1;
FC_in = rand(44,12);
[ f_pl ] = f_pl_Tabelle_43( T_43, V_H_WS, P_WP_KN, FC_in, FC ) ;
The output f_pl is then a matrix with the same dimension as FC_in
Aleksandra Ksiezyk
2020년 2월 20일
Aleksandra Ksiezyk
2020년 2월 20일
답변 (0개)
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!