function h = Bw_gw(p, Bwi, prw, cw) h = Bwi * (1 - cw * (p - prw));