Effacer les filtres
Effacer les filtres

How can I use a ifft function to a symbolic variable ?

5 vues (au cours des 30 derniers jours)
WAN CHO
WAN CHO le 12 Juil 2016
Commenté : Walter Roberson le 13 Juil 2016
for designing optimum-L filter, I have used symbolic method.
t=-100:0.001:100
dt=t(2)-t(1)
f=linspace(-1./(2.*dt),1./(2.*dt),length(t))
if floor(N/2)<(N/2) % N is odd number
k = (N-1)./2;
syms x ohm;
fx=0;
for m=0:k
a=2*m+1;
fx=fx+a*legendreP(m,x);
end
L=(fx/(2^0.5*(k+1)))^2;
y=int(L,-1,(2*ohm^2)-1);
Gain=1/((1+y)^0.5);
I tried to use subs(Gain,ohm,f) and use ifft(ifftshift(Gain)) for getting impulse response function, but it failed. how can i do?
  1 commentaire
Walter Roberson
Walter Roberson le 12 Juil 2016
Where does the "if" end for "if floor" ?

Connectez-vous pour commenter.

Réponses (1)

Karan Gill
Karan Gill le 13 Juil 2016
I'm assuming your error said:
Undefined function 'ifft' for input arguments of type 'sym'.
As the error message says, the output of "subs" is still symbolic. You need to convert it to double by using "double":
Gain = subs(Gain,ohm,f); % Gain is still symbolic
GainDouble = double(Gain); % now Gain is double and can be used by ifft
  1 commentaire
Walter Roberson
Walter Roberson le 13 Juil 2016
In theory, yes. In practice, the f vector is large enough that double() will spend well over half an hour on the computation. I do not know how long it would take to finish; I gave up and canceled it.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by