"Lisa Oziel" <Lisa_Oz
...@yahoo.com> wrote in message <iocjj4$rd
...@fred.mathworks.com>...
> "Animesh Pandey" wrote in message <ioc8et$9g
...@fred.mathworks.com>...
> > clc
> > syms t w
> > int(a);
> > I = sqrt(-1);
> > f = @(t) 0.5*(((t+0.5*a)./abs(t+0.5*a)) - ((t-0.5*a)./abs(-t+0.5*a)));
> > pretty(f(t));
> > H = int(f(t).*exp(-I*w*t), t, -Inf, Inf);
> > pretty(H);
> > The 'H' is coming out to be NaN.
> > 'a' is a constant .....
> > 'H' is basically the Fourier Transform of f(t).
> > If f(t) = heaviside(t+0.5*a) - heaviside(t-0.5*a), then it works fine .....
> > I don't know where I am going wrong !!??
> > Please help !!!
> > THanx
> Are you sure I=sqrt of -1 and when you use the pretty function you just need f same for int use int(f) . The reason for it because you defined t as your variable. Also you have the variable a defined right? Sqrt of negative n umber would get you an imaginary number. Other than that I do not see anything wrong with your code.
--------------------------------------------------------------------------- ----------------------------------
Pretty(H) does not give any error if I replace 'a' by an integer.
But I want 'H' to be general.
'H' is basically the Fourier Transform of f(t).
clc
syms t w a
I = sqrt(-1);
f = @(t) 0.5*(((t+0.5*a)./abs(t+0.5*a)) - ((t-0.5*a)./abs(-t+0.5*a)));
pretty(f(t)); %gives correct plot
H = int(f(t).*exp(-I*w*t), t, -Inf, Inf);
pretty(H); %NaN