You are here: Quick Start
Dew Math for .NET
ContentsIndexHome
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 with C# desktop and .NET Framework.
  • Right click the solution and select "Manage NuGet Packages for the Solution".
  • Search for "Dew Lab Studio" on the public Nuget.org repository and install.
  • 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, Dew.Math.Editors, 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 //from https://github.com/Dew-Research/DewLabStudio-NETFramework-Samples // distribution and has 8000 values only. y.LoadFromFile(@"C:MtxVecDemoFFTData.vec"); //Alternative: //y.CopyFromArray(YourArrayOfdoubles); y.Resize(1024,false); x.FFT(y,false); spec.Mag(x); MtxVecTee.DrawValues(spec,fastLine1,0,1,false); }

 

  • Copy content of:

 

.\YourSolution\Packages\Dew.Math.x.y.z\runtimes 

to corresponding folders: 

C:\Windows\System32 for x64 bit 

C:\Windows\SysWOW64 for x32 bit 

 

  • 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 MtxVecTee.DrawValues(spec,Series1) with MtxVecEdit.ViewValues(spec) and then try MtxVecEdit.ViewValues(x). Play with the menu options in the displayed form.
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!