for loop for matrixes
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
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 commentaires
M
le 20 Fév 2020
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
le 20 Fév 2020
Aleksandra Ksiezyk
le 20 Fév 2020
Réponses (0)
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!