Change of intensity of old points in animation

3 Ansichten (letzte 30 Tage)
Jayant chouragade
Jayant chouragade am 24 Jul. 2020
Hi,
I have three variable X, Y, Z of length 10000 points each .Z represent signal strength. I need to generate animated X,Y plot (scatter) with signal strength represented by color. For persistanace i am plotting 10 new color coded points each frame and making old points white . Code given below.
for i1 = 1:10:(numpoints-10),
plot(xP(1:i1-1),yP(1:i1-1),'w.','markersize',18) ;% Making old points to white
hold on
scatter(xP(i1+(0:9)),yP(i1+(0:9)),32,zP(i1+(0:9)),'filled') % Adding 10 new points for persistence
set(gca,'Color','k');
axis([xMin, xMax, yMin, yMax])
caxis([zMin, zMax])
hold off;
drawnow
end
Instead of making all the old points 'White' , I want to start with grey scale and increase an old point's intensity (alpha) every time, when any of newly added 10 point is same as old point. I would appreciate any suggesion in towards solution.
regards
jayant

Akzeptierte Antwort

Jayant chouragade
Jayant chouragade am 4 Sep. 2020
%
Solved this with below code.
signal_peaks= Normalised Signal Amplitude for given (xP,yP).
signal_peaks1=zeros(1,length(signal_peaks));
for i1 = 10:10:(numpoints-10),
UB=(i1);
LB=(i1-9);
AB=[xP(1:LB)' yP(1:LB)'];
AB_new=[xP(LB:UB)' yP(LB:UB)'];
LIA=ismembertol(AB,AB_new,0.01,'ByRows',true);
signal_peaks1(1:LB)=signal_peaks1(1:LB)+ double(LIA)'.*signal_peaks(1:LB); %% Keep adding the intensity every time point is repeated on that location.
colors=gray(10000);
colormap(colors);
set(gca,'Color','k');
colormap jet;
scat2= scatter(xP(1:i1-1),yP(1:i1-1),'w.','markersize',18) ;% Making old points to white
scat1.MarkerFaceAlpha=0.3;
hold on
scatter(xP(LB:UB),yP(LB:UB),3,signal_peaks1(LB:UB),'filled','o') % Adding 10 new points for persistence
hold off;
drawnow
end

Weitere Antworten (0)

Kategorien

Mehr zu Animation 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