How to change the color of my plots

2 次查看(过去 30 天)
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?

采纳的回答

Simon Chan
Simon Chan 2021-9-20
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

更多回答(1 个)

Mathieu NOE
Mathieu NOE 2021-9-20
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

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by