1

Recently I'm spending my time implementing some patients' analysis using Mathematica Classify function. But I need to rewrite some MATLAB functions for computing input parameters.

There is a problem, that I haven't found an alternative for pmtm function.

In short:
Is there any way how to rewrite this code in Mathematica?

[p,f] = pmtm(data,tapers,n,fs);

Where data is a column vector with 2048 elements, fs = 40, tapers = 8 and n = 2^nextpow2(size(data,1)) = 2048;

Edit:
1. Link to pmtm function is http://www.mathworks.com/help/signal/ref/pmtm.html
2. [pxx,f] = pmtm(x,nw,f,fs) returns the two-sided multitaper PSD estimates at the frequencies specified in the vector, f. The vector, f, must contain at least 2 elements. The frequencies in f are in cycles per unit time. The sampling frequency, fs, is the number of samples per unit time. If the unit of time is seconds, then f is in cycles/sec (Hz).

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
  • 3
    If you use MATLink, then it is as simple as pmtm = MFunction["pmtm", "OutputArguments" -> 2] after you initialize the package. You'd call it as {p, f} = pmtm[data, tapers, n, fs]. – rm -rf Jan 07 '15 at 15:47
  • Now I'm using MATLink, but I need to convert it to C++ / C# .dll in another phase of my project. And MATLAB Coder doesn't support pmtm function, but inMathematica I can use CCodeGeneration. – Zdeněk Tesař Jan 07 '15 at 16:08
  • We can't help with C++/C# conversion either. You can look at the source code by typing edit pmtm. That should give you hints to proceed with your translation attempts. – rm -rf Jan 07 '15 at 16:10
  • 2
    Mathematica code will not be per se easily convertible to C, only a very limited function subset will support direct compilation. – Yves Klett Jan 07 '15 at 16:24
  • 1
    @OleksandrR. To me it looks like the OP just asks wether there is a simple equivalent of this function in Mathematica. We have had and answered questions like that before. – Sjoerd C. de Vries Jan 08 '15 at 06:46
  • @SjoerdC.deVries yes, you could be right. I didn't read it that way, but it is a plausible interpretation. I retract my close vote. – Oleksandr R. Jan 08 '15 at 21:10

0 Answers0