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!