MATLAB: How to filter data corresponding to a limit

if statementlimit

I am trying to filter out temperatures above and below 58oF (limit), then use the filtered data for further coding (trying to evaluate heat transfer in a heat exchanger at temperatures above and below the limit)
example :
T2 = ([10 11 17 18])*9/5 + 32;
limit = (14.5*9/5)+32;
x = find(abs(T2)<limit)
y = find(abs(T2)>limit)
Q_before = m_return_air * Cp_air .* (T3 – x)
Any tips or help would be great. Thanks.
Tony

Best Answer

The ‘x’ and ‘y’ in your code are going to be the indices of the values you want. To get the actual values, this works:
TF = @(C) 1.8.*C + 32; % °C —> °F
TC = 0:20; % Celsius Temperatures
Lim = TF(14.5);
T2 = TF(TC);
x = T2(T2>Lim);
y = T2(T2<Lim);