Marking the roots of a quadratic function in Scilab

1.1k Views Asked by At

I have 2D plotted a simple quadratic function in Scilab and now have to mark the roots with an X. Is there any simple way of doing that? I have written a function that calculates the roots and presents them in a matrix form, but I am thinking this is overkill? Any help with thanks.

1

There are 1 best solutions below

0
On

Pretty much everything in Matlab/Scilab is a matrix of some kind. If you have found the roots $x_1,x_2$, then to plot the points $(x_1,0)$ and $(x_2,0)$ you can use the command

plot([x1 x2], [0 0], 'x')

where 'x' is the mark to be used.

More generally, if you have an array of roots to be plotted, say x, then

plot(x, zeros(x), 'x')

should do the job.