Same colour for two curves in a plot
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kenneth Bisgaard Cristensen
am 7 Apr. 2021
Kommentiert: Kenneth Bisgaard Cristensen
am 7 Apr. 2021
Hi MATLAB Community,
I need to have the first and third cuve the same colour, how do i do that?
I would really ppriciate some help on how to do that.
a = [ 100, 65, 95];
b = [-100, 65, 90];
c = [50, 20, 20];
d = [-25, 20, 20];
x = linspace(-200, 100, 200)
for k = 1:numel(a)
y(k,:) = a(k)+b(k)*tanh((x+c(k))/d(k));
end
figure;
plot(x, y);
0 Kommentare
Akzeptierte Antwort
DGM
am 7 Apr. 2021
Something like this. You'd just have to pick the colors you want.
h=plot(x,y);
set(h, {'color'}, {[1 0 0]; [1 0 1]; [1 0 0]});
Weitere Antworten (1)
Sajid Afaque
am 7 Apr. 2021
you can also use color instead of triplets
h=plot(x,y);
set(h, {'color'}, {'r'; 'b'; 'r'});
2 Kommentare
Siehe auch
Kategorien
Mehr zu Dates and Time finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!