Change of intensity of old points in animation

1 回表示 (過去 30 日間)
Jayant chouragade
Jayant chouragade 2020 年 7 月 24 日
回答済み: Jayant chouragade 2020 年 9 月 4 日
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

採用された回答

Jayant chouragade
Jayant chouragade 2020 年 9 月 4 日
%
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by