function Valve_flow= valve(u)
z=          u(1);
Cv=         u(2);
delta_p=    u(3);
type=       u(4);


if type==1          %equal percentage
    a=1;                %coefficient for equal percentage
    char=a^(z-1); 
elseif type==2      %square root
    char=sqrt(z);
elseif type==3      %linear
    char=z;
end 
 
Valve_flow= Cv*char*(delta_p)^(0.5);     %linear valve

end 