I got stuck while trying to create a nx1 vector from a nxm matrix.
The matrix is created by two inputs, T01(n,1) and RH(1,m). The result is Td(n,m).
When an element of each row is bigger than an other parameter (Ts2), I have to pick up the value of RH.
I created this code, but it isn't working. (I'm writing here the entire code and I know it's a little bit long)
It returns a vector with all hundrends or zeros .
Could anyone help me please ?
Thank you !
function [c] = cond_humidity1 (T01, RH, c2)
rho(i) = 28.96/(0.0821*(T01(i) +273.16));
Ps2(i) = 101300 - ((c2^2)/2)*rho(i);
Ts2(i) = T01(i)-(c2^2)/2060;
T_wall(i) = Ts2(i) + 0.8*(T01(i)-Ts2(i));
Pv_sat(i) = 6.1 *10^((7.4*T01(i))/(T01(i)+240.73));
Pv(i,j) = Pv_sat(i) *(RH(j)/100);
Pv2(i,j) = (Ps2(i)/101300)*Pv(i,j);
Td(i,j) = 230.73/((7.4/log10(Pv2(i,j)/6.1))-1);
It returns a vector with all values 100 or 0