有人可以给小弟我一个高撕分布的函数吗

有人可以给我一个高撕分布的函数吗
有人可以给我一个高撕分布的函数吗

------解决方案--------------------
带了绘图代码,自己看吧


int Gauss(HWND hWnd, HDC hDC, FLOAT a, FLOAT q)
{
RECT rectCanvas;

GetClientRect(hWnd, &rectCanvas);

FillRect(hDC, &rectCanvas, CreateSolidBrush(RGB(255, 255, 255)));

POINT point;

int width = rectCanvas.right - rectCanvas.left;
int height = rectCanvas.bottom - rectCanvas.top;

HPEN pen = CreatePen(PS_DOT, 1, RGB(100, 100, 100));
SelectObject(hDC, pen);
MoveToEx(hDC, rectCanvas.left, rectCanvas.top + height / 2, &point);
LineTo(hDC, rectCanvas.right, rectCanvas.top + height / 2);

MoveToEx(hDC, rectCanvas.left + width / 2, rectCanvas.top, &point);
LineTo(hDC, rectCanvas.left + width / 2, rectCanvas.bottom);


int stick = (int)ceil((float(width)) / 200);
int centerX = width / 2 + rectCanvas.left;
int centerY = height / 2 + rectCanvas.top;

pen = CreatePen(PS_DOT, 1, RGB(255, 100, 100));
SelectObject(hDC, pen);
MoveToEx(hDC, centerX + a * 100, rectCanvas.top, &point);
LineTo(hDC, centerX + a * 100, rectCanvas.bottom);

MoveToEx(hDC, centerX + (a - q) * 100, centerY - 50, &point);
LineTo(hDC, centerX + (a - q) * 100, centerY + 50);

MoveToEx(hDC, centerX + (a + q) * 100, centerY - 50, &point);
LineTo(hDC, centerX + (a + q) * 100, centerY + 50);

SetBkMode(hDC, TRANSPARENT);

HFONT font = CreateFont(
15, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
"Arial "); // lpszFacename

SelectObject(hDC, font);
pen = CreatePen(PS_SOLID, 1, RGB(10, 10, 255));
SelectObject(hDC, pen);
char info[128];
sprintf(info, "%s ", _T( "高斯分布 "));
TextOut(hDC, rectCanvas.left + 10, rectCanvas.top + 10, info, (int)strlen(info));
sprintf(info, "平均值 : %.2f ", a);
TextOut(hDC, rectCanvas.left + 10, rectCanvas.top + 30, info, (int)strlen(info));
sprintf(info, "标准差 : %.2f ", q);
TextOut(hDC, rectCanvas.left + 10, rectCanvas.top + 50, info, (int)strlen(info));
int c = 0;
for (FLOAT f = -(FLOAT)stick; f < (FLOAT)stick; f += 0.01f)
{
FLOAT y = (1.0f / (q * sqrtf(2.0f * 3.141592654f))) * expf(-((f - a) * (f - a)) / (2 * q * q));

int nY = (int)(centerY - y * 1000);
int nX = (int)(centerX + f * 100);

if (f == -(FLOAT)stick)
MoveToEx(hDC, nX, nY, &point);
else
LineTo(hDC, nX, nY);
//SetPixel(hDC, nX, nY, RGB(0, 0, 255));

if (!(c++ % 100))
{

sprintf_s(info, "(%.2f,%.2f) ", f, y);
if (fabs(f - a) < 0.01f)
TextOut(hDC, nX, nY - 15, info, (int)strlen(info));
else if (f > a)