MATLAB BUILDER JA 2 Podręcznik Użytkownika Strona 242

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 292
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 241
5 Sample Applications (Java)
* Sampling interval = 0.01
*/
int[] dims = {1, nSamples};
data = MWNumericArray.newInstance(dims, MWClassID.DOUBLE,
MWComplexity.REAL);
for (int i = 1; i <= nSamples; i++)
{
double t = (i-1)*interval;
double x = Math.sin(2.0*Math.PI*15.0*t) +
Math.sin(2.0*Math.PI*40.0*t) +
Math.random();
data.set(i, x);
}
/* Create new fourier object */
theFourier = new fourier();
/* Compute power spectral density and plot result */
result = theFourier.plotfft(3, data,
new Double(interval));
}
catch (Exception e)
{
System.out.println("Exception:"+e.toString());
}
finally
{
/* Free native resources */
MWArray.disposeArray(data);
MWArray.disposeArray(result);
if (theFourier != null)
theFourier.dispose();
}
}
}
5-12
Przeglądanie stron 241
1 2 ... 237 238 239 240 241 242 243 244 245 246 247 ... 291 292

Komentarze do niniejszej Instrukcji

Brak uwag