如何在zedgraph中进行波动 [英] How Wave motion in zedgraph

查看:110
本文介绍了如何在zedgraph中进行波动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...

我在我的项目中画了一个三角波

组件Zedgraoh:zedgraph中的波动怎么样?



此代码:



  private  < span class =code-keyword> void  CreateGraph(ZedGraphControl zgc)
{
GraphPane myPane = zgc.GraphPane;
// 从正弦函数构成一些数据点
PointPairList list1 = new PointPairList();
double amplitude = double .Parse(textBox1.Text);
double period = double .Parse(textBox3.Text);
double y = 0 ;
for double x = 0 ; x < = double .Parse(textBox2.Text); x + =。 005
{
double p =(x%(period))/ period;
if (p > = 0 && p < = 0 25
y = 4 * p *幅度;
如果(p > 0 25 && p < 0 5
y = amplitude - (p - 0 25 )* 4 *幅度;
如果(p > 0 5 && p < = 0 75
y = -4 *(p - 0 。< span class =code-digit> 5 )*幅度;
如果(p > 0 75 && p < = 1
y = - (幅度 - (p - 0 75 ) * 4 *幅度);
list1.Add(x,y);
}
var line = zg1.MasterPane [ 0 ]。AddCurve(< span class =code-string> ,list1,Color.Blue);
line.Symbol.IsVisible = false ;
zg1.AxisChange();
zg1.Refresh();
zgc.AxisChange();
}





和这张照片:

http://s5.picofile.com/file/8150989518/110033.png [ ^ ]

解决方案

这是类似的:



http://ffden-2.phys.uaf.edu/webproj/212_spring_2014/Greg_Klupar/images/sine_wave.gif [<一个href =http://ffden-2.phys.uaf.edu/webproj/212_spring_2014/Greg_Klupar/images/sine_wave.giftarget =_ blanktitle =New Window> ^ ]

hi...
I in my project drawn a Triangle wave
The component Zedgraoh : How Wave motion in zedgraph ?

this Code :

private void CreateGraph(ZedGraphControl zgc)
		{
			GraphPane myPane = zgc.GraphPane;
			// Make up some data points from the Sine function
            PointPairList list1 = new PointPairList();
            double amplitude = double.Parse(textBox1.Text);
            double period = double.Parse(textBox3.Text);  
            double y = 0;
            for (double x = 0; x <= double.Parse(textBox2.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.Blue); 
            line.Symbol.IsVisible = false;
            zg1.AxisChange();
            zg1.Refresh();			
			zgc.AxisChange();
		}



and this pic :
http://s5.picofile.com/file/8150989518/110033.png[^]

解决方案

this is similar :

http://ffden-2.phys.uaf.edu/webproj/212_spring_2014/Greg_Klupar/images/sine_wave.gif[^]


这篇关于如何在zedgraph中进行波动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆