0

I am trying to fit a non-linear model using 3 independent variables (light, temperature and vapor pressure deficit (VPD)) to predict net ecosystem CO2 exchange (NEE).

I know how to use the nlinfit function, but my problem is that I want to use 2 criteria:-

1. if VPD < 1.3
NEE = (Param(1).*Param(2).*Ind_var(:,1))./(Param(1).*Ind_var(:,1)+Param(2)) + Param(3).*(1.6324.^((Ind_var(:,2)-18)./10));
2. if VPD >= 1.3
NEE = (Param(1).*(Param(2).*exp(-Param(4).*(Ind_var(:,3)-1.3))).*Ind_var(:,1))./(Param(1).*Ind_var(:,1)+(Param(2).*exp(-Param(4).*(Ind_var(:,3)-1.3))))+Param(3).*(1.6324.^((Ind_var(:,2)-18)./10));

Basically, if the independent variable VPD (Vapor pressure deficit) is below 1.3, I want to force my Param(4) = 0.

But I don't know how to do that.

Could you help me? Thanks, Alexis

noufalcep
  • 3,446
  • 15
  • 33
  • 51

1 Answers1

0

You can replace Param(4) by Param(4)*(VPD<1.3). Conditional expressions are evaluated to 1 if true and 0 if false in Matlab.

Eric Fournie
  • 1,362
  • 8
  • 10