Well well...as u guys can see, i am a novice. i need people like u to
help me as i stumble along. never took a matlab class b4, going solo.
not the easiest... will try your suggestions.
On Mar 15, 7:17 pm, "Roger Stafford"
<ellieandrogerxy...@mindspring.com.invalid> wrote:
> matlab_learner <cib...@gmail.com> wrote in message <a969895a2e5f4b7ca82112a8c85fa...@w27g2000pre.googlegroups.com>...
> > so i have written the following code and Matlab complains. can u tell
> > what i am doing wrong? it might b helpful to copy this and run.
> > ........
>
> In the line "x_position = ((x(i)  (a*t))/0.2)+5" you have assumed that because x(i) is an integral multiple of .2, then dividing by .2 will return you to an integer value, but that is not true on binary machines. Roundoff will cause very small errors in the least bit positions and render this false. Try displaying x_position to a high accuracy (17 decimal places or higher) to see how this is true.
>
> You need to rewrite your code so as to ensure an integer. There are a great many ways to do this.
>
> I should also point out that there are many more efficient ways to accomplish other aspects of the code. For example, x can be set up in one line of code: "x = (0:2000)*h;".
>
> Roger Stafford
