How to avoid the split line

7 次查看(过去 30 天)
fasfa
fasfa 2013-10-18
评论: A Jenkins 2013-10-21
Hello,
When I am using the surf matlab's function, I get a split line int he middle of the representation, a plit line produced for a change of colours. I do not know how to avoid that, it shouldn't be there because two consecutive points have the same value so they should have the same color.
It is a littne messy, so I think with an example it would became clearer.
Code:
[Th,Ph]=meshgrid(-20:20,0:1:180);
[mM,nM]=meshgrid(1:10,1:10);
x1=sin(Th*pi/180).*cos(Ph*pi/180);
y1=sin(Th*pi/180).*sin(Ph*pi/180);
Tx=2*pi*x1; Ty=2*pi*y1;
FA=exp(1i.*(mM(:)*Tx(:).'+nM(:)*Ty(:).'));
FA2=ones(100,1).'*FA;
FA3=reshape(FA2,length(Th(:,1)),length(Th(1,:)));
FAxEcp=abs(FA3).'/max(max(abs(FA3)));
AA=20*log10(FAxEcp).';
AA(AA<-35)=-35;
surf(x1,y1,AA,'EdgeColor','none','LineStyle','none');%,'FaceLighting','phong');
az = 180;
el = 90;
view(az, el);
axis([-0.5 0.5 -0.5 0.5 -35 0])
Thanks in advance!

回答(2 个)

A Jenkins
A Jenkins 2013-10-18
编辑:A Jenkins 2013-10-18
Are you allowed to give it a bit more resolution? Changing just the first line solved it for me:
[Th,Ph]=meshgrid(-20:.1:20,0:1:180);
(or at least it made the difference less noticable, since I do see a small step change in your data when it crosses zero)
  1 个评论
A Jenkins
A Jenkins 2013-10-21
Per your comment below dated 19 Oct 2013 at 9:55. Try this:
surf(x1,y1,AA,'EdgeColor','none','LineStyle','none','FaceColor','interp');

请先登录,再进行评论。


fasfa
fasfa 2013-10-19
Thanks A Jenkins,
I noticed that, but the problem is that when the data is big, I can not do that because I have not memory enough (I updated just a simplification of my original problem). And, although giving more resolution gets better result, it does not overcame the problem completely.
Any other thoughts? Thanks again

Community Treasure Hunt

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

Start Hunting!

Translated by