How to change the color of my plots

1 visualización (últimos 30 días)
Mojtaba Mohareri
Mojtaba Mohareri el 20 de Sept. de 2021
Comentada: Mathieu NOE el 21 de Sept. de 2021
Hello everone,
I've plot my figure in matlab as follows
close all
clear all
avalues=0.3:0.01:1;
N=8000;
d=0.03;
a=avalues;
x=0.78;
y=0.81;
X=zeros(N,length(a));
Y=zeros(N,length(a));
for n=1:0.3*N
x=(1-d).*x.*exp(a.*(1-x).*((x/0.2)-1))+d.*y.*exp(a.*(1-y).*((y/0.2)-1));
y=(1-d).*y.*exp(a.*(1-y).*((y/0.2)-1))+d.*x.*exp(a.*(1-x).*((x/0.2)-1));
X(n,:)=x;
Y(n,:)=y;
end
figure (9), hold on
for n=.3*N:N
x=(1-d).*x.*exp(a.*(1-x).*((x/0.2)-1))+d.*y.*exp(a.*(1-y).*((y/0.2)-1));
y=(1-d).*y.*exp(a.*(1-y).*((y/0.2)-1))+d.*x.*exp(a.*(1-x).*((x/0.2)-1));
X(n,:)=x;
Y(n,:)=y;
plot(a,x,'.','MarkerSize',0.01)
hold on
plot(a,y,'.','MarkerSize',0.01)
axis([0.3 1 -1 1.4])
end
hold off
The output is
As we can seen, I have two figures on each other.
How can I change its color to the colors something like this?

Respuesta aceptada

Simon Chan
Simon Chan el 20 de Sept. de 2021
Just put the color code for the markers. May try the following:
for n=.3*N:N
x=(1-d).*x.*exp(a.*(1-x).*((x/0.2)-1))+d.*y.*exp(a.*(1-y).*((y/0.2)-1));
y=(1-d).*y.*exp(a.*(1-y).*((y/0.2)-1))+d.*x.*exp(a.*(1-x).*((x/0.2)-1));
X(n,:)=x;
Y(n,:)=y;
plot(a,x,'r.','MarkerSize',0.01)
hold on
plot(a,y,'b.','MarkerSize',0.01)
axis([0.3 1 -1 1.4])
end

Más respuestas (1)

Mathieu NOE
Mathieu NOE el 20 de Sept. de 2021
hello
I modified a bit your code to get this result :
.code :
close all
clear all
avalues=0.3:0.005:1;
N=200;
d=0.03;
a=avalues;
x=0.78;
y=0.81;
X=zeros(N,length(a));
Y=zeros(N,length(a));
for n=1:0.3*N
x=(1-d).*x.*exp(a.*(1-x).*((x/0.2)-1))+d.*y.*exp(a.*(1-y).*((y/0.2)-1));
y=(1-d).*y.*exp(a.*(1-y).*((y/0.2)-1))+d.*x.*exp(a.*(1-x).*((x/0.2)-1));
X(n,:)=x;
Y(n,:)=y;
end
figure (9), hold on
for n=.3*N:N
x=(1-d).*x.*exp(a.*(1-x).*((x/0.2)-1))+d.*y.*exp(a.*(1-y).*((y/0.2)-1));
y=(1-d).*y.*exp(a.*(1-y).*((y/0.2)-1))+d.*x.*exp(a.*(1-x).*((x/0.2)-1));
X(n,:)=x;
Y(n,:)=y;
plot(a,x,'r.','MarkerSize',15)
hold on
plot(a,y,'b.','MarkerSize',15)
end
axis([0.3 1 0 1.5])
hold off
  2 comentarios
Mojtaba Mohareri
Mojtaba Mohareri el 21 de Sept. de 2021
Hello. I really appreciate.
Mathieu NOE
Mathieu NOE el 21 de Sept. de 2021
my pleasure

Iniciar sesión para comentar.

Categorías

Más información sobre Colormaps 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