I'm trying to make formula for a heat recovery device.
What i want is:
When (ta <=23) OR ((0.2*to+0.8*ta)<=to), the output should be (0.2*to+0.8*ta)
elseif to>16, the output should be (to)
else, the output should be (16)
In matlab code (which gives me the right matrix of temperatures)

matlab results (in excel):

What I entered is:

What I see on the graph is:


as you can see, the graph in VE does not give me what I get in Matlab (the temperatures are much higher). I probably made a mistake in the formula syntax, but I don't see it. Can someone enlighten me?
