📄 signalanalyzer.cs
字号:
/*
* MATLAB Compiler: 4.4 (R2006a)
* Date: Sat Mar 31 16:31:57 2007
* Arguments: "-B" "macro_default" "-M" "-silentsetup" "-S" "-v" "-B"
* "dotnet:SpectraDemoComp,Plotter,1.0,private" "-W"
* "dotnet:SpectraDemoComp,Plotter,1.0,private" "-T" "link:lib" "-d"
* "C:/work/SpectraExample/SpectraDemoComp/src"
* "C:/work/SpectraExample/SpectraDemoComp/plotfft.m"
* "class{SignalAnalyzer:C:/work/SpectraExample/SpectraDemoComp/computefft.m}"
*/
using System;
using System.Reflection;
using MathWorks.MATLAB.NET.Arrays;
using MathWorks.MATLAB.NET.Utility;
namespace SpectraDemoComp
{
/// <summary>
/// The SignalAnalyzer class provides a CLS compliant interface to the M-functions
/// contained in the files:
/// <newpara></newpara>
/// C:/work/SpectraExample/SpectraDemoComp/computefft.m
/// </summary>
/// <remarks>
/// @Version 1.0
/// </remarks>
public class SignalAnalyzer : IDisposable
{
#region Constructors
/// <summary internal= "true">
/// The static constructor instantiates and initializes the MATLAB Common Runtime
/// instance.
/// </summary>
static SignalAnalyzer()
{
Assembly assembly= Assembly.GetExecutingAssembly();
string ctfFilePath= assembly.Location;
int lastDelimeter= ctfFilePath.LastIndexOf(@"\");
ctfFilePath= ctfFilePath.Remove(lastDelimeter, (ctfFilePath.Length - lastDelimeter));
if (MWMCR.InitializeApplication(new string[]{}))
{
mcr= new MWMCR(MCRComponentState.MCC_SpectraDemoComp_name_data,
MCRComponentState.MCC_SpectraDemoComp_root_data,
MCRComponentState.MCC_SpectraDemoComp_public_data,
MCRComponentState.MCC_SpectraDemoComp_session_data,
MCRComponentState.MCC_SpectraDemoComp_matlabpath_data,
MCRComponentState.MCC_SpectraDemoComp_classpath_data,
MCRComponentState.MCC_SpectraDemoComp_libpath_data,
MCRComponentState.MCC_SpectraDemoComp_mcr_application_options,
MCRComponentState.MCC_SpectraDemoComp_mcr_runtime_options,
MCRComponentState.MCC_SpectraDemoComp_mcr_pref_dir,
MCRComponentState.MCC_SpectraDemoComp_set_warning_state,
ctfFilePath, true);
}
}
/// <summary>
/// Constructs a new instance of the SignalAnalyzer class.
/// </summary>
public SignalAnalyzer()
{
}
#endregion Constructors
#region Finalize
/// <summary internal= "true">
/// Class destructor called by the CLR garbage collector.
/// </summary>
~SignalAnalyzer()
{
Dispose(false);
}
/// <summary>
/// Frees the native resources associated with this object
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary internal= "true">
/// Internal dispose function
/// </summary>
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
disposed= true;
if (disposing)
{
// Free managed resources;
}
// Free native resources
}
}
#endregion Finalize
#region Methods
/// <summary>
/// Provides a single output, 0-input interface to the computefft M-function.
/// </summary>
/// <remarks>
/// M-Documentation:
/// COMPUTEFFT Computes the FFT and power spectral density of the input data.
/// [FFTDATA, FREQ, POWERSPECT] = COMPUTEFFT(DATA, INTERVAL)
/// Computes the FFT and power spectral density of the input data.
/// This file is used as an example for the .NET Builder
/// Language product.
/// </remarks>
/// <returns>An MWArray containing the first output argument.</returns>
///
public MWArray computefft()
{
return mcr.EvaluateFunction("computefft");
}
/// <summary>
/// Provides a single output, 1-input interface to the computefft M-function.
/// </summary>
/// <remarks>
/// M-Documentation:
/// COMPUTEFFT Computes the FFT and power spectral density of the input data.
/// [FFTDATA, FREQ, POWERSPECT] = COMPUTEFFT(DATA, INTERVAL)
/// Computes the FFT and power spectral density of the input data.
/// This file is used as an example for the .NET Builder
/// Language product.
/// </remarks>
/// <param name="data">Input argument #1</param>
/// <returns>An MWArray containing the first output argument.</returns>
///
public MWArray computefft(MWArray data)
{
return mcr.EvaluateFunction("computefft", data);
}
/// <summary>
/// Provides a single output, 2-input interface to the computefft M-function.
/// </summary>
/// <remarks>
/// M-Documentation:
/// COMPUTEFFT Computes the FFT and power spectral density of the input data.
/// [FFTDATA, FREQ, POWERSPECT] = COMPUTEFFT(DATA, INTERVAL)
/// Computes the FFT and power spectral density of the input data.
/// This file is used as an example for the .NET Builder
/// Language product.
/// </remarks>
/// <param name="data">Input argument #1</param>
/// <param name="interval">Input argument #2</param>
/// <returns>An MWArray containing the first output argument.</returns>
///
public MWArray computefft(MWArray data, MWArray interval)
{
return mcr.EvaluateFunction("computefft", data, interval);
}
/// <summary>
/// Provides the standard 0-input interface to the computefft M-function.
/// </summary>
/// <remarks>
/// M-Documentation:
/// COMPUTEFFT Computes the FFT and power spectral density of the input data.
/// [FFTDATA, FREQ, POWERSPECT] = COMPUTEFFT(DATA, INTERVAL)
/// Computes the FFT and power spectral density of the input data.
/// This file is used as an example for the .NET Builder
/// Language product.
/// </remarks>
/// <param name="numArgsOut">The number of output arguments to return.</param>
/// <returns>An Array of length "numArgsOut" containing the output
/// arguments.</returns>
///
public MWArray[] computefft(int numArgsOut)
{
return mcr.EvaluateFunction(numArgsOut, "computefft");
}
/// <summary>
/// Provides the standard 1-input interface to the computefft M-function.
/// </summary>
/// <remarks>
/// M-Documentation:
/// COMPUTEFFT Computes the FFT and power spectral density of the input data.
/// [FFTDATA, FREQ, POWERSPECT] = COMPUTEFFT(DATA, INTERVAL)
/// Computes the FFT and power spectral density of the input data.
/// This file is used as an example for the .NET Builder
/// Language product.
/// </remarks>
/// <param name="numArgsOut">The number of output arguments to return.</param>
/// <param name="data">Input argument #1</param>
/// <returns>An Array of length "numArgsOut" containing the output
/// arguments.</returns>
///
public MWArray[] computefft(int numArgsOut, MWArray data)
{
return mcr.EvaluateFunction(numArgsOut, "computefft", data);
}
/// <summary>
/// Provides the standard 2-input interface to the computefft M-function.
/// </summary>
/// <remarks>
/// M-Documentation:
/// COMPUTEFFT Computes the FFT and power spectral density of the input data.
/// [FFTDATA, FREQ, POWERSPECT] = COMPUTEFFT(DATA, INTERVAL)
/// Computes the FFT and power spectral density of the input data.
/// This file is used as an example for the .NET Builder
/// Language product.
/// </remarks>
/// <param name="numArgsOut">The number of output arguments to return.</param>
/// <param name="data">Input argument #1</param>
/// <param name="interval">Input argument #2</param>
/// <returns>An Array of length "numArgsOut" containing the output
/// arguments.</returns>
///
public MWArray[] computefft(int numArgsOut, MWArray data, MWArray interval)
{
return mcr.EvaluateFunction(numArgsOut, "computefft", data, interval);
}
/// <summary>
/// Provides an interface for the computefft function in which the input and output
/// arguments are specified as an array of MWArrays.
/// </summary>
/// <remarks>
/// This method will allocate and return by reference the output argument
/// array.<newpara></newpara>
/// M-Documentation:
/// COMPUTEFFT Computes the FFT and power spectral density of the input data.
/// [FFTDATA, FREQ, POWERSPECT] = COMPUTEFFT(DATA, INTERVAL)
/// Computes the FFT and power spectral density of the input data.
/// This file is used as an example for the .NET Builder
/// Language product.
/// </remarks>
/// <param name="numArgsOut">The number of output arguments to return</param>
/// <param name= "argsOut">Array of MWArray output arguments</param>
/// <param name= "argsIn">Array of MWArray input arguments</param>
///
public void computefft(int numArgsOut, ref MWArray[] argsOut, MWArray[] argsIn)
{
mcr.EvaluateFunction("computefft", numArgsOut, ref argsOut, argsIn);
}
#endregion Methods
#region Class Members
private static MWMCR mcr= null;
private bool disposed= false;
#endregion Class Members
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -