why I'm getting error with symsum?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have tried this code to calculate energy and power of discrete time functions. but I get errors. how can I fix it?
syms n f z N;
f=input('enter function: ','s');
f = symfun(eval(f), n);
f=f*conj(f);
f = matlabFunction(f);
y(N)=symsum(f, -N , N);
energy=limit(y(N),N,inf);
z(N)=y(N)/(2*N+1);
pow=limit(z(N),N,inf);
9 comentarios
geometry geometry
el 19 de Mzo. de 2018
Editada: geometry geometry
el 19 de Mzo. de 2018
Walter Roberson
el 19 de Mzo. de 2018
You did not use the 'file' option of matlabFunction .
You have
for i=-N:N
but you have not defined N .
Your later line E=limit(E(N),N,inf); would expect N to be sym, but it is not permitted to have a for loop over symbolic range.
Note: you should probably be replacing your heaviside with piecewise, as heaviside has ambiguous meaning at 0.
Respuestas (0)
Ver también
Categorías
Más información sobre Numbers and Precision 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!