Prev: using mask with boundary conditions
Next: GUIDE gui handles visibility to user defined function
From: Stefan Andreevski on 6 May 2010 19:12 "Laurentiu " <laurREMOVECAPSmarinovici(a)gmail.com> wrote in message <hrv9kp$cee$1(a)fred.mathworks.com>... > Hey > Does anybody have any suggestions about how I could let MATLAB know that it should consider a number like 5.67*10^(-5) equal to 0, especially since, for example, all the other coefficients of the polynomial are of at least 10^(-2) order? > > Thanks Hey Laurentiu, A really easy trick would be just to decide your tollerance and do some simple rounding. Let's say you allow at most 3 consecotive zeros after the decimal point (e.g. 0.000123) Then your tol will be 1000000. Multiply all your data by your tolerance e.g.: 0.000123 x 1000000 = 123 and then round it, ceil it, floor it or whatever you would choose. Again divide it by your multiplier A pole like -0.0000000123 will just become 0.123 after multiplication and then 0 after rounding. Divide zero by your multiplier and again you will get a zero. You lose a lot of precision using this approach, but I am also doing control engineering and I know precission sometimes messes things more than it actually helps. Cheers, Stefan
From: Laurentiu on 6 May 2010 21:43 "Stefan Andreevski" <standreevski(a)gmail.com> wrote in message <hrvic4$d0s$1(a)fred.mathworks.com>... > "Laurentiu " <laurREMOVECAPSmarinovici(a)gmail.com> wrote in message <hrv9kp$cee$1(a)fred.mathworks.com>... > > Hey > > Does anybody have any suggestions about how I could let MATLAB know that it should consider a number like 5.67*10^(-5) equal to 0, especially since, for example, all the other coefficients of the polynomial are of at least 10^(-2) order? > > > > Thanks > > Hey Laurentiu, > > A really easy trick would be just to decide your tollerance and do some simple rounding. > Let's say you allow at most 3 consecotive zeros after the decimal point (e.g. 0.000123) > Then your tol will be 1000000. Multiply all your data by your tolerance > e.g.: 0.000123 x 1000000 = 123 > and then round it, ceil it, floor it or whatever you would choose. Again divide it by your multiplier > A pole like -0.0000000123 will just become 0.123 after multiplication and then 0 after rounding. Divide zero by your multiplier and again you will get a zero. > You lose a lot of precision using this approach, but I am also doing control engineering and I know precission sometimes messes things more than it actually helps. > > Cheers, > Stefan Stefan, Thanks a lot for your suggestion. And,actually, thanks to all of you guys for all suggestions. I will take them all into consideration and hopefully get my stuff done. Cheers
From: dpb on 7 May 2010 10:19 Laurentiu wrote: > "Stefan Andreevski" <standreevski(a)gmail.com> wrote in message > <hrvic4$d0s$1(a)fred.mathworks.com>... >> "Laurentiu " <laurREMOVECAPSmarinovici(a)gmail.com> wrote in message >> <hrv9kp$cee$1(a)fred.mathworks.com>... >> > Hey >> > Does anybody have any suggestions about how I could let MATLAB know >> that it should consider a number like 5.67*10^(-5) equal to 0, >> especially since, for example, all the other coefficients of the >> polynomial are of at least 10^(-2) order? >> > > Thanks >> >> Hey Laurentiu, >> >> A really easy trick would be just to decide your tollerance and do >> some simple rounding. >> Let's say you allow at most 3 consecotive zeros after the decimal >> point (e.g. 0.000123) >> Then your tol will be 1000000. Multiply all your data by your tolerance >> e.g.: 0.000123 x 1000000 = 123 and then round it, ceil it, floor it or >> whatever you would choose. Again divide it by your multiplier >> A pole like -0.0000000123 will just become 0.123 after multiplication >> and then 0 after rounding. Divide zero by your multiplier and again >> you will get a zero. >> You lose a lot of precision using this approach, but I am also doing >> control engineering and I know precission sometimes messes things more >> than it actually helps. >> >> Cheers, >> Stefan > > Stefan, > Thanks a lot for your suggestion. And,actually, thanks to all of you > guys for all suggestions. I will take them all into consideration and > hopefully get my stuff done. I'd point out that if your case is always that of the intercept term that estimating the coefficients w/o it will have the side benefit of the other coefficients being estimated under that condition instead of simply truncating one ex post facto.... --
First
|
Prev
|
Pages: 1 2 3 Prev: using mask with boundary conditions Next: GUIDE gui handles visibility to user defined function |