integration of FFT

조회 수: 3 (최근 30일)
Anita
Anita 2014년 12월 19일
댓글: Anita 2014년 12월 19일
I am supposed to calculate the fft of a rect function, and then getting the integration of answer. what I have done is :
fs = ceil(4*pi)+1;
xend = 3;
t = (0:1/fs:xend-1/fs)-1/3*xend;
x_f = zeros([1,fs*xend]);
x_f(1,(1/3*xend*fs):(2/3*xend*fs-1)) = 5.7737e19.*ones([1,(1/3*xend*fs)]);
m_f = length(x_f);
n = pow2(nextpow2(m_f))*4;
y = fft(x_f,n);
f = (0:n-1)*(fs/n);
power = y.* conj(y)/n;
y0 = fftshift(y); f0 = (-n/2:n/2-1)*(fs/n)/pi;
power0 = abs(y0);
plot(f0,power0);
K_fourier=power0;
K_int = int(K_fourier, -pi, pi);
then, I have this error: Undefined function 'int' for input arguments of type 'double'.
could anyone help me please?
Thank you

채택된 답변

Star Strider
Star Strider 2014년 12월 19일
Use the trapz function.

추가 답변 (2개)

Thorsten
Thorsten 2014년 12월 19일
The is no such function as int in Matlab. What is int supposed to do?
  댓글 수: 1
Anita
Anita 2014년 12월 19일
numerical integration.

댓글을 달려면 로그인하십시오.


Shoaibur Rahman
Shoaibur Rahman 2014년 12월 19일
편집: Shoaibur Rahman 2014년 12월 19일
K_fourier is double type in your code. int cannot take double type as the function.
@ Thorsten: int performs all symbolic, definite, and indefinite integration of a function defined, and given as the input argument to int.
  댓글 수: 1
Anita
Anita 2014년 12월 19일
Thanks for your answer. Well, I'm aware about it and searching for a way to get the integration somehow. do you have any idea if it is possible to get integral of a 1x256 complex double or any other way to solve this problem?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by