I am computing a Fourier transformation in MATLAB, when computing coefficients C[0] and C[n*f0], I got pretty nasty result because MATLAB doesn’t recognize my variable “n” as integer. I currently compute with “n” as a symbolic variable (syms n;). How to change symbolic n to symbolic integer n?
I am computing a Fourier transformation in MATLAB, when computing coefficients C[0] and C[n*f0]
Share
Looking at the MATLAB documenation, to add the assumption “
nis integer” in R2008b or later, you have to writeThis answers your question, however, I’m not really sure it solves your problem.
When you do a Fourier transform, you are performing a heavy numeric operation on your data, consequently all variables involved in that need to have concrete values. Your
nprobably should be an integer, but not just by type, it should contain an actual number. If you declare it usingsyms, it will potentially not contain a number, so you be sure you really need the symbolic toolbox!If you do, and
nis the result of a calculation that yield one specific integer, you can convert it to normal numerical form usinguint32(n)or similar, see the help on conversions, e.g.Update: The error message you give in the comment implies that your
nis in fact not an integer… I doubt you will be able to use it with fft.