I want to plot with different colors for each value of vm1

1 view (last 30 days)
vetri veeran
vetri veeran on 20 Jul 2017
Answered: KSSV on 20 Jul 2017
Hi all,
I want to plot the each value of vm1 with different colors manually.
I attached only the short code which is given below,
for . .
vm1=[0.4;0.3975;0.395;0.39;0.385;0.38;-0.32;-0.33;-0.34;-0.35;-0.36;-0.37;-0.4];
for i=1:13
vm=vm1(i);
im=mem_appr(y(:,1),vm,param).*vm;
p=vm.*im;
der_state=(A*sinh(vm/sigma_off).*exp(-(y_off./y(:,1)).^2).*exp(1./(1+beta*p)).*(exp(-k*vm)./(1+exp(-k*vm)));
plot(y(:,1),der_state, 'linewidth',2)
hold all
end
end
Could anyone please help me.

Answers (1)

KSSV
KSSV on 20 Jul 2017
plot(x,y,'color','r') ;
The above command plot's (x,y) data in red color.
If you want to put your colors of choice, check the below codes:
c = {'r' 'b' 'g'} ;
figure
hold on
for i = 1:3
plot(rand(1,10),'color',c{i})
end
figure
hold on
for i = 1:3
plot(rand(1,10),'color',rand(1,3))
end

Community Treasure Hunt

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

Start Hunting!