public FunctionTableItem[] GenerateSample(int n, double period) { Sample = new FunctionTableItem[n]; for (int i = 0; i < n; i ++ ) Sample[i] = new FunctionTableItem(); Period = period; Step = Period*PeriodNum/n; return GenerateSample(); }
public FunctionTableItem[] GenerateSample(int n, double period) { Sample = new FunctionTableItem[n]; for (int i = 0; i < n; i++) { Sample[i] = new FunctionTableItem(); } Period = period; Step = Period * PeriodNum / n; return(GenerateSample()); }
public void AddInfo(FunctionTableItem[] fun, ValueIs value = ValueIs.Magnitude, bool addChart = false) { Excel.Series series; Excel.Range temp; range = range.get_Resize(2, fun.Length); range.set_Value(Missing.Value, GetArray(fun, value)); if (addChart) { LastIndex += chartHeight + 10; chartObject = charts.Add(400, LastIndex, chartWidth, chartHeight); } currentChart = chartObject.Chart; series = ((Excel.SeriesCollection) currentChart.SeriesCollection(Type.Missing)).NewSeries(); temp = range.get_Resize(1, fun.Length); series.Values = temp; series.XValues = temp.get_Offset(1, 0); currentChart.ChartType = Excel.XlChartType.xlXYScatterSmoothNoMarkers; range = range.get_Offset(3, 0); }
private double[,] GetArray(FunctionTableItem[] fun, ValueIs value = ValueIs.Magnitude) { double[,] temp = new double[2, fun.Length]; for(int i = 0; i < fun.Length ; i++) { switch(value) { case ValueIs.Magnitude: temp[0, i] = fun[i].Value.Magnitude; break; case ValueIs.Real: temp[0, i] = fun[i].Value.Real; break; case ValueIs.Img: temp[0, i] = fun[i].Value.Imaginary; break; case ValueIs.Phase: temp[0, i] = fun[i].Value.Phase; break; } temp[1, i] = fun[i].Arg; } return temp; }
public FunctionTableItem[] ApplyStep(FunctionTableItem[] inp) { for (int i = 0; i < inp.Length; i++) inp[i].Arg *= Step; return inp; }