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

조회 수: 2 (최근 30일)
Abdulaziz
Abdulaziz 2011년 11월 28일
Hi Everyone: When I run this script:
syms t
x=-3:.1:3;
for i=1:length(x);
Pin=3*exp(-t^2);
z=x(i);
Eo(i)=int(Pin,t,-inf,z);
Ein(i)=int(Pin,t,-inf,inf);
E(i)=Eo (i)/Ein(i);
Go=1000;
G(i)=Go/(Go-(Go-1)*exp(-E(i)*0.1));
Pin=3*exp(-x(i)^2);
Pout(i)=Pin*G(i);
Poutf=fftshift(fft(Pout,100000));
f=(-100000/2:(100000/2-1)).*1/(0.01*100000);
end
plot(f,abs(Poutf),'-r*')
I face this error:
Undefined function or method 'fft' for input arguments of type 'sym'.
Could anyone help me please?

답변 (2개)

Wayne King
Wayne King 2011년 11월 28일
fft is not overloaded for symbolic inputs. fft() is only for numeric inputs. If you want the Fourier transform of a symbolic input, see fourier

Walter Roberson
Walter Roberson 2011년 11월 28일
Use E(i) = double(Eo (i)/Ein(i));
Note: it is a waste of time to do the integrations ever iteration. Do the integration with a symbolic upper bound once before the loop, evaluate that with infinity as the upper bound once before the loop to get the constant Ein, and then in your loop subs() your x(i) in to the indefinite integral as the upper bound to get Eo(i).
The ratio will, by the way, come out as (1+erf(x(i))/2

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by