help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

not equivalent?


From: Albert F. Niessner
Subject: not equivalent?
Date: 07 Nov 2002 15:46:15 -0500

I have two vectors (series and spacing) of 500x1 elements each. If I
then do the following (N = length(series);):

  k=0:N-1;
  W = e.^(-j*2*pi*(spacing*k)/N);
  spectrum = W' * series;

I get some answer. Because of the size of W, it may be worth while to
loop over very large vectors so I can also do it this way:

  w = -j*2*pi*spacing/N;
  for k=1:N
    W = e.^(w*(k-1));
    spectrum(k) = sum (series .* W);
  endfor;


I then used the same vectors in both cases and get different results --
max (abs((abs(r1) - abs(r2))) < 10^-10 but max(abs(r1 - r2)) > 450. I
have not checked the phase angle because I am not sure that information
would reduce my confusion.

So, why are the results different? Is there some implied precision
difference between the matrix-vector multiplication and multiplying
followed by and accumulation?

Example data has been attached.

Al Niessner

Attachment: example.oct.gz
Description: GNU Zip compressed data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]