Plotting two types of graph together

1 回表示 (過去 30 日間)
Jennifer
Jennifer 2011 年 4 月 15 日
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

採用された回答

Friedrich
Friedrich 2011 年 4 月 15 日
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 件のコメント
Jennifer
Jennifer 2011 年 4 月 15 日
Brilliant - Thanks!

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by