Re: storing values
- From: "carlos lopez" <clv2clv_00000000_@xxxxxxxxxxxxx>
- Date: Mon, 22 Oct 2007 22:16:52 +0000 (UTC)
"Nick Sutch" <nicksutch15@xxxxxxxxxxx> wrote in message
<ffhmut$sr7$1@xxxxxxxxxxxxxxxxxx>...
"us " <us@xxxxxxxxxxxxxxx> wrote in message <ffgj3l$oe9Sorry, but I could not understand clearly what you want.
$1@xxxxxxxxxxxxxxxxxx>...
Nick Sutch:
<SNIP FP evergreen...
Sr= sin(2.*pi.*1e3.*t)
any value which is equal to 0 displays as
number of around the order of -1e-12...
well, yes
n=5;
f=4e3;
t=1:1/f:1+((n-1)/f);
s=sin(2.*pi.*1e3.*t);
sprintf('%34.30f\n',s)
us
Thanks for the help. However, I really need to store the
values which are equal to the order of -1e-12 as 0 for
future calculations. For example: cos(0)=1 where as cos (-
6.1234e-12) does not equal 1. I appreciate the numbers are
very small and close to 0 but I was wondering if there is a
way to store the day as shorts?
Unfortunately, cos(near zero) is near 1, so you should
specify what rule to follow.
If you, for example, want just a few decimals after the dot
you can issue
N=1e5;%for five decimals
s=round(N*sin(2.*pi.*1e3.*t))/N;
The plot of "s" will look similar to the original, but the
numbers will not the sin() of what is originally intended.
Hope this helps
Regards
Carlos
.
- References:
- Re: storing values
- From: us
- Re: storing values
- From: Nick Sutch
- Re: storing values
- Prev by Date: Re: vectorized distance between two points?
- Next by Date: Re: plot two vectors
- Previous by thread: Re: storing values
- Next by thread: Re: 3d lookup table
- Index(es):
Relevant Pages
|
Loading