help-octave
[Top][All Lists]
Advanced

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

fourier coefficient - quad with more arguments?


From: Gerrit
Subject: fourier coefficient - quad with more arguments?
Date: Tue, 28 Sep 2004 20:03:30 +0200
User-agent: Mutt/1.4.1i

Hi,

I'm trying to do something like this:

all_a = ones(1, 20);
for k = 1:20
  function y = f(t)
    x = mod(t, pi);
    s = t*(pi-t);
    y = s*cos(k*t);
  endfunction
  a = (2/pi) * quad('f', 0, pi);
  all_a(k) = a;
endfor

But I get:

error: `k' undefined near line 8 column 15
error: evaluating binary operator `*' near line 8, column 16
error: evaluating argument list element number 1
error: evaluating binary operator `*' near line 8, column 10
error: evaluating assignment expression near line 8, column 7
error: called from `f'
error: evaluating for command near line 4, column 1
error: near line 13 of file `/srv/www/studie/s_en_t/opg15.m'

How do I pass the 'k' from the for loop into the function and calculate
the integration? I'm trying to calculate real fourier coefficients. Any
hints?

yours,
Gerrit.

-- 
Weather in Twenthe, Netherlands 28/09 19:25:
        16.0°C   wind 6.3 m/s WSW (57 m above NAP)
-- 
Ervaringen met het Syndroom van Asperger:
        http://topjaklont.student.utwente.nl
Socialistische Partij:
        http://www.sp.nl/



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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