How to avoid the split line
3 views (last 30 days)
Show older comments
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!
0 Comments
Answers (2)
A Jenkins
on 18 Oct 2013
Edited: A Jenkins
on 18 Oct 2013
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 Comment
A Jenkins
on 21 Oct 2013
Per your comment below dated 19 Oct 2013 at 9:55. Try this:
surf(x1,y1,AA,'EdgeColor','none','LineStyle','none','FaceColor','interp');
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!