フィルターのクリア

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 Center および File ExchangeStress and Strain についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by