Borrar filtros
Borrar filtros

How to get color bar for 2-D plot?

1 visualización (últimos 30 días)
Saneesh Ali
Saneesh Ali el 14 de En. de 2019
I am ploting a number of ellipse in a single plot.First i created the ellipse, then I rotate the ellipse through an angle theta by multiplying with a rotation matrix, then i plot it. I want to give a color bar according to the orientation of the ellipse. Any help will be highly appreciated.
Thank you
for ut=1:length(PMAX1)
a=PMAX1(ut,1);
b=PMIN1(ut,1);
uh=.15;
xc=5;
yc=frr(ut,1);
alpha=the1(ut,1);
m = 1000;
x = zeros(m,1);
y = zeros(m,1);
theta = linspace(0,2*pi,m);
for k = 1:m
x(k) = .2 * cos(theta(k));
y(k) = uh * sin(theta(k));
end
R = [cos(alpha) -sin(alpha); ...
sin(alpha) cos(alpha)];
rCoords = R*[x' ; y']; % we use the [] to create a 2xm array
xr = rCoords(1,:)'; % extract the rotated x coordinates
yr = rCoords(2,:)'; % extract the rotated y coordinates
plot(xr+xc,yr+yc,'b')
hold on
end

Respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots 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