fourier transform in matlab

1.4k Views Asked by At

getting an error while trying to do fourier transform. my code:

    clc;
clear all;
close all;
syms A1 B1 C1 D1 w;

%% define
t = -4:1/100:4;
wm=3*pi;
z=t-(pi/wm);
a=1./(pi*z);
b=sinc(2*wm*z);
c=sinc(wm*z);
A1=fourier(a,z,w);
B1=fourier(b,z,w);
C1=fourier(c,z,w);
D1=fourier(a,z,w);

and the error is:

Undefined function 'fourier' for input arguments of type 'double'.

Error in h2 (line 13)
A1=fourier(a,z);

When I check for "which fourier" to see if I have it, MATLAB is able to give the correct location of the fourier.m on my system. Then why is this occurring?

1

There are 1 best solutions below

2
On BEST ANSWER

The error is because Matlab doesn't find the function fourier. Be sure that a file named fourier.m resides in your current working directory. Also check if this function is able to work with two parameters. Alternatively you can use addpath to add the directory where this file lies.

Maybe you want to use the fast fourier transform from matlab fft.