To save the lower and higher limit of the roots in MATLAB, you can use the min
and max
functions to compare the roots and assign the values to x1
and x2
respectively. Additionally, to convert the symbolic constants to double you can use the double
function. Here is an example code snippet:
main.m349 chars13 lines
In this example, we first define a quadratic equation using symbolic variables. Then, we solve the equation using the solve
function and obtain the roots in symbolic form (sols
). Next, we convert the roots to double using the double
function and find the lower and upper limit using the min
and max
functions respectively. Finally, we display the results using the disp
function.
gistlibby LogSnag