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