Matlab: Fourier transforms in numeric form

Thread Starter

tquiva

Joined Oct 19, 2010
176
I have the following problem:



I was able to do part (a), but got stuck when I got to part (b).
So far, my code is:

Rich (BB code):
n=7; star=-2*n:2*n;
bbox=(abs(star)<=n); bbox=bbox/sqrt(sum(bbox.^2));
cox=cos(pi*star/(2*n+1)).*bbox; cox=cox/sqrt(sum(cox.^2));
c2ox=cos(pi*star/(2*n+1)).*cox; c2ox=c2ox/sqrt(sum(c2ox.^2));
% Plots for n=7
subplot(331),plot(star,bbox),xlabel('*'),ylabel('bbox(*)'),title('bbox(*) for n=7')
subplot(332),plot(star,cox),xlabel('*'),ylabel('cox(*)'),title('cox(*) for n=7')
subplot(333),plot(star,cox),xlabel('*'),ylabel('cox(*)'),title('cox(*) for n=7')

% Decrease n by 1
n=6; star=-2*n:2*n;
bbox=(abs(star)<=n); bbox=bbox/sqrt(sum(bbox.^2));
cox=cos(pi*star/(2*n+1)).*bbox; cox=cox/sqrt(sum(cox.^2));
c2ox=cos(pi*star/(2*n+1)).*cox; c2ox=c2ox/sqrt(sum(c2ox.^2));
% Plots for n=6
subplot(334),plot(star,bbox),xlabel('*'),ylabel('bbox(*)'),title('bbox(*) for n=6')
subplot(335),plot(star,cox),xlabel('*'),ylabel('cox(*)'),title('cox(*) for n=6')
subplot(336),plot(star,cox),xlabel('*'),ylabel('cox(*)'),title('cox(*) for n=6')

% Increase n by 1
n=8; star=-2*n:2*n;
bbox=(abs(star)<=n); bbox=bbox/sqrt(sum(bbox.^2));
cox=cos(pi*star/(2*n+1)).*bbox; cox=cox/sqrt(sum(cox.^2));
c2ox=cos(pi*star/(2*n+1)).*cox; c2ox=c2ox/sqrt(sum(c2ox.^2));
% Plots for n=8
subplot(337),plot(star,bbox),xlabel('*'),ylabel('bbox(*)'),title('bbox(*) for n=8')
subplot(338),plot(star,cox),xlabel('*'),ylabel('cox(*)'),title('cox(*) for n=8')
subplot(339),plot(star,cox),xlabel('*'),ylabel('cox(*)'),title('cox(*) for n=8')
Then for part (b), I tried:

Rich (BB code):
n=7; star=-2*n:2*n;
bbox=(abs(star)<=n); bbox=bbox/sqrt(sum(bbox.^2));
cox=cos(pi*star/(2*n+1)).*bbox; cox=cox/sqrt(sum(cox.^2));
c2ox=cos(pi*star/(2*n+1)).*cox; c2ox=c2ox/sqrt(sum(c2ox.^2));

fourier(bbox)
but I received an error that said:

??? Undefined function or method 'fourier' for input
arguments of type 'double'.

Is there another way to do this? I tried googling other methods but I can't find any, so if anyone could please help, I greatly appreciate it.
 

Attachments

Thread Starter

tquiva

Joined Oct 19, 2010
176
You probably meant 'fft' not fourier.
Thank you! It works now. But now, I'm not too sure of what the problem means by "closely approximate."

On Matlab, I entered fft(bbox), and obtain a matrix of values. Is there some sort of command on matlab that'll "approximate" the fourier transform?
 

Georacer

Joined Nov 25, 2009
5,182
From what I understand the exercise asks you to use the Symbolic Math package of Matlab (not included in basic editions) to calculate the Fourier sequences through their mathematical formula, based on their given expressions. Not an easy task, as the Symbolic Math package is a bit stiff in my opinion.

Then in (c), you are asked to go back to the original signal, based on the fourier sequences found in (b), again using Symbolic Math.

I haven't done a fourier transformation by hand in years, so I can't be of much help in the actual solving. I suggest using the standard formula found in all the textbooks.
 
Top