What you have done is programmed a function. So this function calculates fval when you give a value of x.
You can now call this function by typing in the command prompt:
fval = bisectCase2(x);
This will give you fval for x=3; Note that the function should be in the search path (so for example in your current directory).