|
|
@ -8,35 +8,38 @@ namespace Signal_Generator |
|
|
|
{ |
|
|
|
class FmSignal : IAnalogSignal |
|
|
|
{ |
|
|
|
private double ampl = 0; |
|
|
|
private double freq = 0; |
|
|
|
private IAnalogSignal modSignal; |
|
|
|
public Dictionary<string, double> paramsDict { get; set; } |
|
|
|
|
|
|
|
public string ParamsToString |
|
|
|
public string typeToString |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return this.ToString() + |
|
|
|
" | А = " + ampl + |
|
|
|
" | f = " + freq; |
|
|
|
return "FM сигнал"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public override string ToString() |
|
|
|
public string paramsToString |
|
|
|
{ |
|
|
|
return "FM signal"; |
|
|
|
get |
|
|
|
{ |
|
|
|
string result = ""; |
|
|
|
foreach (KeyValuePair<string, double> pair in paramsDict) |
|
|
|
result += " / " + pair.Key + " " + pair.Value; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public FmSignal(double ampl, double freq, IAnalogSignal modSignal) |
|
|
|
public FmSignal(double ampl, double freq, double ampl2) |
|
|
|
{ |
|
|
|
this.ampl = ampl; |
|
|
|
this.freq = freq; |
|
|
|
this.modSignal = modSignal; |
|
|
|
paramsDict = new Dictionary<string, double>(); |
|
|
|
paramsDict.Add("Амплитуда несущей", ampl); |
|
|
|
paramsDict.Add("Частота несущей", freq); |
|
|
|
paramsDict.Add("Амплитуда", ampl); |
|
|
|
} |
|
|
|
|
|
|
|
public double currentAmplitude(double t) |
|
|
|
{ |
|
|
|
return ampl * Math.Sin(2 * Math.PI * freq * t + modSignal.currentAmplitude(t)); |
|
|
|
return paramsDict.ElementAt(0).Value * Math.Sin(2 * Math.PI * paramsDict.ElementAt(1).Value * t + paramsDict.ElementAt(1).Value * Math.Sin(t)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|