Undefined function or method 'fft' for input arguments of type 'sym'.
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Wayne King
el 28 de Nov. de 2011
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 comentarios
Walter Roberson
el 28 de Nov. de 2011
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 comentarios
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!