Graph of a truss

4 Ansichten (letzte 30 Tage)
latenfe
latenfe am 20 Mär. 2021
Bearbeitet: latenfe am 21 Mär. 2021

Antworten (1)

John D'Errico
John D'Errico am 20 Mär. 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)
ans = 1×3
0 0 1
Cfun(1)
ans = 1×3
1 0 0
Cfun(0.25)
ans = 1×3
0.2500 0 0.7500
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.

Kategorien

Mehr zu Stress and Strain finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by