필터 지우기
필터 지우기

assign interpolated color bar value to plot

조회 수: 3 (최근 30일)
Samuel Thompson
Samuel Thompson 2017년 11월 3일
Code Extract
My code plots the deflection of a cantilever beam. I wish to change the colour of the deflected shape to correspond to associated stress values from the colourmap.
plot3(A(:,1),A(:,2),A(:,3),'k')
hold on
c=colorbar;
set(c, 'ylim', [min(abs(stress)) max(abs(stress))])
caxis([min(abs(stress)) max(abs(stress))])
for i = 1:length(stress)
plot3(A((2*i)-1:2*i,4),A((2*i)-1:2*i,5),A((2*i)-1:2*i,6))
hold on
end
axis equal
I believe that a solution would involve comparing the stress in the member for the current iteration [stress(i)], with the range of values from the colourmap and subsequently assigning a colour (perhaps in RGB format) that can be included within the plot3 command.
for i = 1:length(stress)
plot3(A((2*i)-1:2*i,4),A((2*i)-1:2*i,5),A((2*i)-1:2*i,6),'%%INSERT APPROPRIATE COLOURMAP VALUE HERE%%)
hold on
end
But I have yet to find a working solution. Any help would be very much appreciated.
Sam!
Note:
  • [stress] = [1x4888] matrix corresponding to the shear stress in each member.
  • Colormap limits comply with stress values
  • for loop plots each member individually (total of 4888)

답변 (0개)

카테고리

Help CenterFile Exchange에서 Stress and Strain에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by