2016-11-24 3 views
0

저는 Matlab을 처음 사용하고 있습니다.이 두 그래프의 차이점을 알아내는 데 어려움을 겪고 있습니다.Matlab_ 두 그래프의 차이 플롯

% 2D plot of original target locations 
X= double(xCoords); 
Y= double(yCoords); 
originalvalues = hist3([X(:) Y(:)],[30 40]); 
imagesc(originalvalues) 
contourf(originalvalues) 
c= colorbar; 
c.Label.String = 'Initial location'; 
axis equal 
axis xy 
xlabel('endCoordinatesx'); 
ylabel('endCoordinatesy'); 
title('2D Map of Original locations'); 

% 2D plot of final target locations 
Xf= Design.endCoordinatesX; 
Yf= Design.endCoordinatesY; 
values = hist3(double([Xf(:) Yf(:)],[30 40])); 
imagesc(values) 
contourf(values) 
c= colorbar; 
c.Label.String = 'Final location'; 
axis equal 
axis xy 
xlabel('endCoordinatesx'); 
ylabel('endCoordinatesy'); 
title('2D Map of final locations'); 

답변

0

나는 당신의 문제를 이해하면, 당신은 두 데이터 세트의 차이를 나타내는 세 번째 플롯을 만들고 싶어요.

은 당신이해야 할 일은 당신이 계산 모든 히스토그램에 대한 일반 쓰레기통을 얻을 수 있습니다 :

% find common centers for the two datasets 
[~, centers] = hist3(cat(2,[X(:) ; Xf(:)],... 
          [Y(:) ; Yf(:)]),... 
        [30 40]); 

% then you can calculate the histogram for each set of data : 
originalvalues = hist3([X(:) Y(:) ], centers); 
values   = hist3([Xf(:) Yf(:)], centers); 

% finaly, compute the difference between the two (now the bins are "aligned") 
differenceValue = values - originalvalues; 
+0

당신이 @beesleep 감사합니다! 그것은 많은 도움이되었습니다 !! – Mraquel