I am trying to plot velocity vectors but they are not getting displayed in a single graph.How can I do that?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have the following code and I want all my vectors to be displayed in a single graph.But my code gives different graph for every iteration.How can I make them to be displayed in single graph.
n_mat_cell=cell(nframes-1,1); % this stores the n vectors of each component in previous frame
for n=1:nframes-1
n_mat_cell{n}=zeros(2, nclusters(n)); % 2 x number of components in previous frame
for i=1:nclusters(n)
[~,indx]=max(res_cell{n}(i,:));
n_mat_cell{n}(1,i)=caCentroids{n+1}(1,indx)-caCentroids{n}(1,i);
n_mat_cell{n}(2,i)=caCentroids{n+1}(2,indx)-caCentroids{n}(2,i);
quiver( n_mat_cell{n}(1,i),n_mat_cell{n}(2,i))
end
end
0 Kommentare
Antworten (1)
Alexandra Harkai
am 3 Nov. 2016
hold on
% your code here
hold off
Where 'hold on' will 'Retain current plot when adding new plots' according to the Documentation, 'hold off' will turn the hold state off so new plots will clear existing plots.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Vector Fields 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!