Graph of a truss
4 ビュー (過去 30 日間)
古いコメントを表示
回答 (1 件)
John D'Errico
2021 年 3 月 20 日
Just plot each line segment using line, where you define the end points of the segments. You can provide a color spec for each segment as you wish.
As far as changing from red to blue, What is red in terms of RGB? [it is [1 0 0]. What is blue? it is [0 0 1]. You can choose a value between the two end points simply enough, as
Cred = [1 0 0];
Cblue = [0 0 1];
Cfun = @(t) Cred*t + Cblue*(1-t);
You might want to change that mapping to decide what happens in the interior of the path through color space, but that should suffice. For example, should the mid level go through a mid level gray? Or should it be a vaguely purplish color?
So for any intermediate color based on the parameter t, we would see
Cfun(0)
Cfun(1)
Cfun(0.25)
In your code, you will simply need to transform the stresses you find, something like this:
t = (stress - min(stress))./(max(stress) - min(stress));
The maximum stress will now map to red, the min stress will map to blue.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Structural Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!