ghasem deh

ghasem deh

  • NA
  • 258
  • 40.3k

how do draw motion wave with zedgraph

Nov 14 2014 6:21 AM
hi
1 – I want to draw a sine and sawtooth wave…
2 – And use the timer to draw wave motion
3 - how i can clean chart
4 – and combined two-wave (modulation)? I use this code to draw a triangle wave
(textbox = amplitude – frequency – time) :
---------------------------------------------------
GraphPane myPane = zgc.GraphPane;
// Make up some data points from the Sine function
PointPairList list1 = new PointPairList();
double amplitude = double.Parse(textBox2.Text);
double period = double.Parse(textBox3.Text);
double y = 0;
for (double x = 0; x <= double.Parse(textBox1.Text); x += .005)
{
double p = (x % (period)) / period;
if (p >= 0 && p <= 0.25)
y = 4 * p * amplitude;
if (p > 0.25 && p < 0.5)
y = amplitude - (p - 0.25) * 4 * amplitude;
if (p > 0.5 && p <= 0.75)
y = -4 * (p - 0.5) * amplitude;
if (p > 0.75 && p <= 1)
y = -(amplitude - (p - 0.75) * 4 * amplitude);
list1.Add(x, y);
}
var line = zg1.MasterPane[0].AddCurve("", list1, Color.Goldenrod);
line.Symbol.IsVisible = false;
zg1.AxisChange();
zg1.Refresh();
zgc.AxisChange();

Answers (1)