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.

45 lines
1.3 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Signal_Generator
{
class FmSignal : IAnalogSignal
{
public Dictionary<string, double> paramsDict { get; set; }
public string typeToString
{
get
{
return "FM сигнал";
}
}
public string paramsToString
{
get
{
string result = "";
foreach (KeyValuePair<string, double> pair in paramsDict)
result += " / " + pair.Key + " " + pair.Value;
return result;
}
}
public FmSignal(double ampl, double freq, double ampl2)
{
paramsDict = new Dictionary<string, double>();
paramsDict.Add("Амплитуда несущей", ampl);
paramsDict.Add("Частота несущей", freq);
paramsDict.Add("Амплитуда", ampl);
}
public double currentAmplitude(double t)
{
return paramsDict.ElementAt(0).Value * Math.Sin(2 * Math.PI * paramsDict.ElementAt(1).Value * t + paramsDict.ElementAt(1).Value * Math.Sin(t));
}
}
}