图正弦波......? [英] Graph Sine Wave ... ?

查看:98
本文介绍了图正弦波......?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...

我已经制定了一个正弦波代码:

  private   double  DegreeToRadian( double  angle)
{
return Math.PI * angle / int .Parse(textBox3.Text);
}

私有 void 绘制( double N)
{
int Yoffset = panel1.Height / 2 ;
Graphics G = panel1.CreateGraphics();
Pen P = new 笔(Color.Yellow, 1 .5f);
float x1,y1;
for double X = 0 ; X < = 360 ; X ++)
{
x1 = ( float )X;
y1 = Yoffset +(( float )Math.Sin(DegreeToRadian(X * N))* int .Parse(textBox2.Text));
G.DrawRectangle(P,x1,y1,.5f,.5f);
}
P.Dispose();
}





然后Button_Click:



绘制( int  .Parse(textBox1.Text)); 





现在我想...我如何以赫兹显示频率?

解决方案

假设您的正弦函数取决于时间及其时域假设是无限的(时间:-∞到+∞)。然后,如果所有360°(2 *π)的相位变化需要时间t,则频率为1 / t。



非无限时域使事情变得相当复杂。例如,如果函数为零(或任何其他常数值),除了时间轴上的某些固定段(例如图像上描绘的段),则光谱将连续(而且广泛的,在那种情况下)。它计算为傅立叶变换 https://en.wikipedia.org/wiki/Fourier_transform [ ^ ]。



如果函数严格定期(严格也意味着无限域时间),则光谱离散并计算为傅立叶系列 https://en.wikipedia.org/wiki/Fourier_series [ ^ ]。



请注意频谱由不仅具有频率,频率/相位的点组成,显然也可以表示为复数。



我提到的无限时域上的正弦函数只是严格周期f的特例这是微不足道的,它使频率为1 / t和某个相位的一条线的离散频谱。



-SA

Hi ...
I've drawn up a code of sine wave :

private double DegreeToRadian(double angle)
        {
            return Math.PI * angle / int.Parse(textBox3.Text);
        }

        private void Draw(double N)
        {
            int Yoffset = panel1.Height / 2;
            Graphics G = panel1.CreateGraphics();
            Pen P = new Pen(Color.Yellow, 1.5f);
            float x1, y1;
            for (double X = 0; X <= 360; X++)
            {
                x1 = (float)X;
                y1 = Yoffset + ((float)Math.Sin(DegreeToRadian(X * N)) * int.Parse(textBox2.Text));
                G.DrawRectangle(P, x1, y1, .5f, .5f);
            }
            P.Dispose();
        }



Then Button_Click :

Draw(int.Parse(textBox1.Text));



Now I want ... How do I display the frequency in hertz?

解决方案

Let's assume your sine function depends on time and its time domain is supposed to be infinite (time: −∞ to +∞). Then, if all 360° (2*π) of phase change takes time t, the frequency is 1/t.

Non-infinite time domains makes things quite complicated. If, for example, the function is zero (or any other constant value) everywhere except some fixed segment on the time axis, such as the segment depicted on your image, the spectrum will be continuous (and rather wide, in that case). It is calculated as Fourier transform https://en.wikipedia.org/wiki/Fourier_transform[^].

If the function is strictly periodical ("strictly" also implies infinite domain in time), the spectrum is discrete and is calculated as the Fourier series: https://en.wikipedia.org/wiki/Fourier_series[^].

Note that a spectrum consists of the points which are characterized not just with frequency, but frequency/phase, which, apparently also can be expressed as a complex number.

The case of the sine function on an infinite time domain I mentioned fist is just the special case of strictly periodic function, which is trivial and makes the discrete spectrum of just one line at the frequency 1/t and some phase.

—SA


这篇关于图正弦波......?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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