I found answer is 130 but i'm not sure.
I tried this:
r = input("Please input the intensity value, r: ");
fprintf("\n");
r1 = 70;
r2 = 150;
s1 = 30;
s2 = 230;
Point_1 = [0 0];
Point_2 = [r1 s1];
Point_3 = [r2 s2];
Point_4 = [255 255];
x = 1;
y = 2;
%Slope of region 1%
Rise = Point_2(y) - Point_1(y);
Run = Point_2(x) - Point_1(x);
Slope_1 = Rise/Run;
%Slope of region 2%
Rise = Point_3(y) - Point_2(y);
Run = Point_3(x) - Point_2(x);
Slope_2 = Rise/Run;
%Slope of region 3%
Rise = Point_4(y) - Point_3(y);
Run = Point_4(x) - Point_3(x);
Slope_3 = Rise/Run;
if r <= r1
fprintf("Region 1\n");
s = Slope_1*r;
fprintf("The output intensity, s = T(r) is: %.2f\n",s);
elseif (r1 < r) && (r < r2)
fprintf("Region 2\n");
Constant_Offset = s1;
Relative_Run = (r - r1);
s = Slope_2*Relative_Run + Constant_Offset;
fprintf("The output intensity, s = T(r) is: %.2f\n",s);
elseif r >= r2
fprintf("Region 3\n");
Constant_Offset = s2;
Relative_Run = (r - r2);
s = Slope_3*Relative_Run + Constant_Offset;
fprintf("The output intensity, s = T(r) is: %.2f\n",s);
end