Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Calculating FT using matlab quad function

  1. Nov 25, 2009 #1
    Hi All,
    I am new to this forum and new to using the quad function. Some assistance would be most helpful. I appreciate all help in advance.

    I have a .m file called OneExpDecay.m that has the following

    syms t
    x=exp(-2*t^2);
    [RX,IX]=ft(x,-inf,inf);

    then I have an ft.m that has the following

    function [RX,IX]=ft(x,a,b)
    syms t f
    fr=@(t)x*cos(2*pi*f.*t);
    RX=quad(fr,a,b);
    fim=@(t)x*sin(2*pi*f.*t);
    IX=-quad(fim,a,b);

    When I run OneExpDecay.m I get the following errors that I do not understand how to resolve

    ?? Undefined function or method 'isfinite' for input arguments of type 'sym'.

    Error in ==> quad at 81
    if ~isfinite(y(1))

    Error in ==> ft at 4
    RX=quad(fr,a,b);

    Error in ==> OneExpDecay at 3
    [RX,IX]=ft(x,-inf,inf);





    Thanks
    Lefti
     
  2. jcsd
  3. Nov 25, 2009 #2
    The error that your receiving about functions being undefined for inputs of type sym means that you're trying to send a symbol into a function that is expecting a number (or numbers).

    Here, my guess is that you need to use finite limits (inf and -inf won't cut it). Try replacing them with numbers.

    Hope this helps.

    -Kerry
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Calculating FT using matlab quad function
Loading...