Undefined function or method 'fft' for input arguments of type 'sym'.
2 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(2 个)
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
0 个评论
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!