1
我得到了2个包含数字的文件。一个数字用于计算骨骼的最大压缩量,而另一个数字则是骨骼上的压缩量。如果第二个数字高于最大压缩率,我想用红色绘制点,如果它小于那么它应该是绿色。
我的问题是,即使大部分的应该是绿色的,我所有的点都会变成红色。我试图通过打印出H和C矢量来调试它,并且有100个数字应该是红色的,其余的是绿色的。任何帮助或暗示赞赏。比较Matlab中的元素和绘图
这是我的代码
p=VarName5;
c=VarName7*2.5; %%The compression that is on the bone
if p<0.317;
H=10500*p.^1.88; %%Calculate max compression the bone handles
else
H=114*p.^1.72; %%Calculate max compression the bone handles
end
if(c < H) %% if the compression on the bone is smaller then max compression
plot(p,c,'+G') %% plot using green+
hold on
else
plot(p,c,'+R') %if the compression is higher than max compression use red+
end
hold off
完美的,正是我所期待的。不知道我可以使用这样的情节。 – 2014-10-20 15:36:52