Plotting graph to represent positive/negative roots of polynomial.

4 visualizaciones (últimos 30 días)
Alexander Kimbley
Alexander Kimbley el 31 de Oct. de 2019
Respondida: Samatha Aleti el 4 de Nov. de 2019
Hi,
I have code the calcualtes the roots for a polynomial over the double loop of 2 variables. I'm trying to plot a graph in (L,M) space which indicates at each point ( for 0<L, M<1), via colouring, if both roots are postive, one root being positive or none.
Thanks.

Respuestas (1)

Samatha Aleti
Samatha Aleti el 4 de Nov. de 2019
As per my understanding you want to plot the points(roots) using different colors according to sign of both the roots. One of the ways do to this is use “scatter” and pass a vector indicating different colors as an input argument to it. Here is the sample code by assuming data x,y:
x = 1:10;
y = 2:2:20;
cmap = jet(length(x)); % generates 10 colors (RGB values)
scatter(x, y, 10, cmap);
You can define a color vector accordingly and use “scatter” to achieve desired plot.
Refer the following link for more details on ”scatter”:

Categorías

Más información sobre Scatter Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by