You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
6 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
6 years ago
|
using System.Collections.ObjectModel;
|
||
6 years ago
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
|
||
|
namespace Signal_Generator
|
||
|
{
|
||
6 years ago
|
class SinusoidalSignal : AnalogSignalMethods, IAnalogSignal
|
||
6 years ago
|
{
|
||
6 years ago
|
public string typeToString
|
||
|
{
|
||
6 years ago
|
get { return "SIN сигнал"; }
|
||
6 years ago
|
}
|
||
6 years ago
|
|
||
6 years ago
|
public new string paramsToString
|
||
6 years ago
|
{
|
||
6 years ago
|
get { return paramsToString(paramsCollection); }
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
public Collection<Parameter> paramsCollection { get; set; }
|
||
6 years ago
|
|
||
|
public SinusoidalSignal(double ampl, double freq, double phase = 0)
|
||
|
{
|
||
6 years ago
|
paramsCollection = new Collection<Parameter>();
|
||
|
paramsCollection.Add(new Parameter("Амплитуда", ampl));
|
||
|
paramsCollection.Add(new Parameter("Частота", freq));
|
||
|
paramsCollection.Add(new Parameter("Фаза", phase));
|
||
6 years ago
|
}
|
||
|
|
||
|
public double currentAmplitude(double t)
|
||
|
{
|
||
6 years ago
|
var c = paramsCollection.ToArray<Parameter>();
|
||
|
return c[0].value * Math.Sin(2 * Math.PI * c[1].value * t + c[2].value);
|
||
6 years ago
|
}
|
||
|
}
|
||
|
}
|