How get numeric values from symbolic function
Mostrar comentarios más antiguos
Hi, I've defined a symbolic function st(t) and I'm trying to calculate the Fourier transform with the function of matlab fourier()
syms sf(f)
sf(f) = fourier(st(t),t,f);
but if I run the code
sf(1)
I get something like
ans = (1508120030528433*fourier(heaviside(fix(t) - t + 1/2)*heaviside(t - fix(t) - 2/5)*cos(2000000000*pi*t - 2328776796587809/2251799813685248), t, 1))/38685626227668133590597632 + (1508120030528433*fourier(heaviside(t - fix(t) - 3/5)*heaviside(fix(t) - t + 7/10)*cos(2000000000*pi*t - 2328776796587809/2251799813685248), t, 1))/38685626227668133590597632...
while if I run
ezplot(sf)
I get
Error in inline expression ==>
(6900523987068279.*fourier(cos(2000000000.*pi.*t
+
1282404220501851./562949953421312).*heaviside(t
- fix(t) - 1./5).*heaviside(fix(t)
- t + 3./10), t,
f))./154742504910672534362390528 +
(6900523987068279.*fourier(cos(2000000000.*pi.*t
+
1282404220501851./562949953421312).*heaviside(t
- fix(t) - 4./5).*heaviside(fix(t)
- t + 9./10), t,
f))./154742504910672534362390528 +
(6898037065725127.*fourier(heaviside(fix(t)
- t + 1./5).*heaviside(t - fix(t) -
1./10).*cos(2000000000.*pi.*t +
5130279707333783./2251799813685248),
t, f))./154742504910672534362390528
...
Undefined function 'fourier' for
input arguments of type 'double'.
Error in inline/feval (line 34)
INLINE_OUT_ =
inlineeval(INLINE_INPUTS_,
INLINE_OBJ_.inputExpr,
INLINE_OBJ_.expr);
Error in ezplotfeval (line 54)
z = feval(f,x(1),y(1));
Error in ezplot>ezimplicit (line
258)
u = ezplotfeval(f, X, Y);
Error in ezplot (line 154)
hp =
ezimplicit(cax,
f{1}, vars, labels,
args{:});
Error in sym/ezplot (line 61)
h = ezplot(fhandle(f));
Error in calcolo_classico_s_di_w
(line 115)
ezplot(sf)
Also If I use
double(sf(1))
I get an error.
Could someone tell me how I can get numeric values of sf(f), like double(sf(1)), without errors? Thanks
Respuestas (0)
Categorías
Más información sobre Discrete Fourier and Cosine Transforms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!