How to change the color of a graph line when using comet function?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi everyone! I was wondering if there is any way to change the color of the line being generated in my code to a different color?
%% System Clearing
clc;
clear all;
close all;
%% Walking/step Conditions
stepsL=1; %stepping to the left
stepsR=1; %stepping to the right
%% Random Walking - 2500 steps
for n = 1: 2500
x = rand ;
if (x >= 0.5)
stepsL = stepsL + 1; % if moving left
else
stepsR = stepsR + 1; % if moving right
end
location(n) = stepsL - stepsR; % location tracker for direction
end
comet(location)
0 comentarios
Respuestas (1)
KSSV
el 15 de Abr. de 2020
[m,n] = size(Location) ; % hoping Location to be m*2 array
for i = 1:m
plot(Location(1:i,1),Location(1:i,2),'color','r')
drawnow
end
0 comentarios
Ver también
Categorías
Más información sobre Spline Postprocessing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!