简体   繁体   English

c# 方程在图中画了一个洞

[英]c# equation is drawing a hole in the graph

        for (double x=0;x<=7D;x+=.01D)
        {
            b = 1.771289; c = 2.335719; d = 0.5855771; g = 4.4990302; h = 4.3369349; k = 0.67356705;
            y = b * Math.Exp(-(0.5 * (Math.Pow(((x - c) / d), 2)))) +
                g * Math.Exp(-(0.5 * (Math.Pow(((x - h) / k), 2))));
            qResults.Rows.Add(x, y);
        }

the graph is good but it draws a hole in the peek.i am using mschart:图表很好,但它在 peek 中画了一个洞。我正在使用 mschart:

http://imageshack.us/photo/my-images/824/graph1v.png/ http://imageshack.us/photo/my-images/824/graph1v.png/

i would like to know whether the hole is a problem with my syntax?我想知道这个洞是不是我的语法有问题?

It seems that your y-axis range is bounded by the maximum value, but the very point falls exactly outside the plotting range.您的 y 轴范围似乎受最大值的限制,但该点恰好落在绘图范围之外。

One solution is to add a small amount to the axis range such that all points fall clearly inside the plotting space.一种解决方案是向轴范围添加少量,以使所有点都清楚地落在绘图空间内。

Try making the max y range for the graph a little over the max value.尝试使图形的最大y范围略高于最大值。 If the max value is 4.5 then make the graph y-axis limit equal to 5.0.如果最大值为 4.5,则使图形 y 轴限制等于 5.0。

There's nothing wrong with your syntax, that really should be a smooth curve.你的语法没有问题,那真的应该是一条平滑的曲线。 I stuck it into matlab just to be certain.为了确定,我将它插入 matlab 中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM