用rand产生一个随机数;里面既有正数又又负数。 比如要产生-2到5之间的随机数 x=-2+(5-(-2))*rand(1,100) http://www.ilovematlab.cn/thread-91507-1-1.html