assign interpolated color bar value to plot
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Stress and Strain 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!