From: Laurens on 5 Aug 2010 06:09 Hi, I'm trying to make a Matlab movie of a function I wrote, using the spy command. The problem is that some elements that should be zero in the matrix I want to plot, are actually -0.0000 (or 0.0000), probably due to rounding errors. How do I make sure these will actually be 0? I tried rounding every element that I expect to be 0 with the round function, but this seems to me a very inefficient and dirty way. Isn't there a more elegant way to make sure these elements that are "almost zero" don't occur? They screw up the frames generated by the spy command. Thanks.
From: Neil Stewart on 5 Aug 2010 06:25 "Laurens " <laurens.vankeer(a)student.kuleuven.be> wrote in message <i3e2k1$ce9$1(a)fred.mathworks.com>... > Hi, > > I'm trying to make a Matlab movie of a function I wrote, using the spy command. > > The problem is that some elements that should be zero in the matrix I want to plot, are actually -0.0000 (or 0.0000), probably due to rounding errors. How do I make sure these will actually be 0? > > I tried rounding every element that I expect to be 0 with the round function, but this seems to me a very inefficient and dirty way. Isn't there a more elegant way to make sure these elements that are "almost zero" don't occur? They screw up the frames generated by the spy command. > > Thanks. Hi, I'm not familiar with the spy command so I'm not sure if I can be of much use to you. Maybe you could implement a tolerance threshold? Var(Var<0.000001 | Var>-0.000001)=0 Neil
From: Laurens on 5 Aug 2010 07:50 Hi Neil, I think you meant Var(Var<0.000001 & Var>-0.000001)=0, instead of the "or" (otherwise all elements will be 0), and that seems to work! Thanks!
From: Neil Stewart on 5 Aug 2010 07:56 "Laurens " <laurens.vankeer(a)student.remove.this.kuleuven.be> wrote in message <i3e8hh$pd9$1(a)fred.mathworks.com>... > Hi Neil, > > I think you meant Var(Var<0.000001 & Var>-0.000001)=0, instead of the "or" (otherwise all elements will be 0), and that seems to work! Thanks! Yeah, my bad! Glad I could help.
|
Pages: 1 Prev: Vectorisation With Indefinite Indices Next: mean of quantized image |