If you define the function discriminant
anonymously, like so:
descriminant = @(x) 24*x.^2 - 32;
Then all you have to do is type the following statement in the command line or function you're running:
D = discriminant(xAns)
If your function has been defined using the elementwise operator '.' wherever necessary, then the statement above will print out the discriminant
function evaluated at every element of the matrix xAns
, regardless of its size or shape. The values returned will be in the same shape as the matrix xAns
. I think that would be the easiest way to solve your problem.