Plotting two types of graph together

1 vue (au cours des 30 derniers jours)
Jennifer
Jennifer le 15 Avr 2011
Hello
I wonbder if anyone can please help me. I have a scatter plot of co-ordinates and I wish to plot this as a scatter diagram. However I would like to have two circles plotted as well in order to show the inner and outer limits of the co-ordinates. I have managed to create separate plots of these but have not been able to combine them. Does anyone know how this can be achieved?
Please see my example code below:
t = linspace(0,2*pi,1000);
h=-3.3958; %centre
k=58.9725; %centre
r=0.0009; %radius
R=r*2.5; %radius
a=R*cos(t)+h;
b=R*sin(t)+k;
x = r*cos(t)+h;
y = r*sin(t)+k;
scatter(West,North);
plot(a,b,x,y);
axis square;
fill(a,b,'r',x,y,'k');
axis([-3.4,-3.35,58.95,59.0]);
Thank you

Réponse acceptée

Friedrich
Friedrich le 15 Avr 2011
Hi Jennifer,
I could not run you code because West and North are unknown so I replaced it with random values. But I think what your are looking for is:
t = linspace(0,2*pi,1000);
h=-3.3958; %centre
k=58.9725; %centre
r=0.0009; %radius
R=r*2.5; %radius
a=R*cos(t)+h;
b=R*sin(t)+k;
x = r*cos(t)+h;
y = r*sin(t)+k;
hold on
axis square;
axis([-3.4,-3.35,58.95,59.0]);
plot(a,b,x,y);
fill(a,b,'r',x,y,'k');
scatter(rand(100,1)*0.05 - 3.4,rand(100,1)*0.05 + 58.95);
hold off
Friedrich
  1 commentaire
Jennifer
Jennifer le 15 Avr 2011
Brilliant - Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by