Graph of a truss
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
0 commentaires
Réponses (1)
John D'Errico
le 20 Mar 2021
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 commentaires
Voir également
Catégories
En savoir plus sur Structural Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!