FFT error 'not supported to carry out script fft as a function'
古いコメントを表示
I want to plot a graph as below. so I wrote a program using fft. but error message 'not supported to carry out script fft as a function' displayed. What should I do?
syms t f
T=5.0*10^(-10);
roll = 0.3;%roll-off β
A = pi*t/T;
x(t)= sin(A)/A*cos(roll*A)/(1-(2*roll*t/T)^2);
ht=matlabFunction(x(t));
y=fft(x(t));
X = f;
Y = y;
plot(X,Y);
formula of x(t),X(f) and graph I want to plot(green line) are shown as follows



採用された回答
その他の回答 (1 件)
Walter Roberson
2022 年 12 月 8 日
0 投票
you named your file fft.m which makes it impossible to call the Mathworks fft function. You need to rename your fft.m
5 件のコメント
柊介 小山内
2022 年 12 月 8 日
Walter Roberson
2022 年 12 月 8 日
In your code, your x(t) is a symbolic function.
You can never fft() a symbolic function or symbolic expression. fft() is strictly the discrete fourier transform, which must be applied to numeric values (especially double precision), not to symbolic values (even if they are symbolic numbers).
If you wanted to take the fourier transform of a symbolic function or symbolic expression you would use fourier
柊介 小山内
2022 年 12 月 9 日
柊介 小山内
2022 年 12 月 9 日
Walter Roberson
2022 年 12 月 9 日
編集済み: Walter Roberson
2022 年 12 月 9 日
syms t f
T = sym(5.0)*10^(-10);
roll = sym(0.3);%roll-off β
A = sym(pi)*t/T;
x(t)= sin(A)/A*cos(roll*A)/(1-(2*roll*t/T)^2);
y(f)=fourier(x(t))
char(x)
Notice that the result has unevaluated calls to fourier(). That means that fourier() was unable to compute the fourier transform of that function.
I checked on Wolfram Alpha, which was able to come up with a transformation... but MATLAB is not able to do so.
カテゴリ
ヘルプ センター および File Exchange で Spectral Measurements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!














