Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


I have a question concerning 'result difference'

coolpursuitcoolpursuit Member Posts: 1
I'm College student, and now studying Matlab.

I saw a verification problem. problem is following...

Let x(n) be a random sequence uniformly distributed between [0,1] over 0> x = rand(1,11); n=0:10;
>> k = 0:500; w = (pi/500)*k;
>> X = x * (exp(-j*pi/500)).^(n'*k); % DTFT of x
>> y = x; m = n+2;
>> Y = y * (exp(-j*pi/500)).^(m'*k); % DTFT of y
>> % verification
>> Y_check = (exp(-j*2).^w).*X;
>> error = max(abs(Y-Y_check)); % difference
error =

My question is that,
1) What is the reason that error is NOT zero?
error is very very marginal value, but I think, that error must be zero in digital calculation(like MATLAB)
Could you tell me the reason?

2) and, if there is way that error be zero, Could you teach me about that?

Before that EXAMPLE, I think that all digital calculation has same result.
for example, 1 + 2 + 3 = 6
Anytime, and by any computer, 1 + 2 + 3 = 6.

I really really want to know about that.

Please someone answer my question...


  • jjasso5jjasso5 Member Posts: 41
    Digital calculators and computers have limitations in accuracy.
    They are working with a limited number of bits and bytes, and that
    creates a problem...

    You're not working with continuous values but with discrete ones, and
    you'll loose the information in between those discrete values.

    For example, calculate this simple operation, manually and with Matlab
    3*(4/3 - 1) - 1

    What did you expect?

Sign In or Register to comment.