You are here: Quick Start
Dew Math for .NET
Contents
PreviousUpNext
Quick Start

Using Dew Math for .NET routines is a peace of cake. Now you can perform complex numeric tasks with only few function calls.

  • Create new project.
  • Add the following assemblies to the project reference list ("Project -> Add Reference" menu):Dew.Math.dll,Dew.Math.Tee.dll, Borland.Delphi.dll.
  • All these assemblies are located in Dew Lab Studio Dew Math Assemblies folder.
  • Add a TChart and a Button controls on the form. Add new fast line series to TChart (right-click on the TChart, then select "Edit" menu item, then click on the "Add Series" button.
  • In code section, add the following assemblies to the using section: Dew.Math, Dew.Math.Units, Dew.Math.Tee Insert the following code:

 

private void button1_Click(object sender, System.EventArgs e) {
  Vector x = new Vector(0);
  Vector y = new Vector(0);
  Vector spec = new Vector(0);
  // Please include the full path of the file.
  // The file is included with the MtxVec BasicDemo
  // distribution and has 8000 values only.
  y.LoadFromFile(@"C:MtxVecDemoFFTData.vec");
  y.Resize(1024,false);
  x.FFT(y,false);
  spec.Mag(x);
  TeeChart.DrawValues(spec,fastLine1,0,1,false);
}

 

  • F5 to compile and run, press Button1.
  • should be looking at the frequency spectra displaying one series of harmonics.

 

Things to try:

  • Change the 1024 value to some other values that are power of two. (512 or 2048).
  • Use Steema.TeeChart.Styles.Area chart style.
  • Make the spectra logarithmic in the amplitude (use the Log10 method).
  • Save spectra to a file, then load it and draw to the chart with DrawValues.
  • Replace DrawValues(spec,Series1) with ViewValues(spec) and then try ViewValues(x). Play with the menu options in the displayed form.
What do you think about this topic? Send feedback!
Copyright (c) 1999-2010 by Dew Research. All rights reserved.