对数采样 [英] Logarithmic sampling

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

问题描述

我正在处理 [minValue,maxValue] 之间的值,我想在此范围之间创建一个值向量.但我想要更多接近 minValue 的值.

I am working with values between [minValue,maxValue] and I want to create a vector of values in between this range. But I want more values near to the minValue.

示例:

分钟 = 1最大值 = 100

min = 1 max = 100

向量 = [1,1.1,1.5,2,3,5,10,15,30,50,100];

vector = [1,1.1,1.5,2,3,5,10,15,30,50,100];

类似的东西.

目标是在最小值附近更准确.

The goal is to be more accurate around the minimum.

可以实现吗?

推荐答案

您可以从以恒定步长(例如 0.1)生成从 0 到 1 的数字开始.然后用一些指数为它们供电——指数越大,曲线越陡峭.然后移动并乘以进入您想要的最小-最大范围.

You can start with by generating numbers from 0 to 1 with constant step (for example 0.1). Then power them with some exponent - the bigger exponent, the sharper curve. Then shift and multiply to get into your desired min-max range.

伪代码:

min = 1.0
max = 100.0
exponent = 2.0 // Sharpness
result = []

for(i = 0.0; i <= 1.0; i += 0.1) {
    result.push(pow(i, exponent) * (max - min) + min)
}

这篇关于对数采样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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