How to avoid the split line

11 Ansichten (letzte 30 Tage)
fasfa
fasfa am 18 Okt. 2013
Kommentiert: A Jenkins am 21 Okt. 2013
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!

Antworten (2)

A Jenkins
A Jenkins am 18 Okt. 2013
Bearbeitet: A Jenkins am 18 Okt. 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 Kommentar
A Jenkins
A Jenkins am 21 Okt. 2013
Per your comment below dated 19 Oct 2013 at 9:55. Try this:
surf(x1,y1,AA,'EdgeColor','none','LineStyle','none','FaceColor','interp');

Melden Sie sich an, um zu kommentieren.


fasfa
fasfa am 19 Okt. 2013
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

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by