本文整理汇总了C++中Signal::at_t方法的典型用法代码示例。如果您正苦于以下问题:C++ Signal::at_t方法的具体用法?C++ Signal::at_t怎么用?C++ Signal::at_t使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Signal
的用法示例。
在下文中一共展示了Signal::at_t方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inner_product
Signal SignalSpace::inner_product(const Signal& a, const Signal& b,
double t_s, double t_e,
double dt, int cnt)
{
assert(t_e > t_s);
double t = 0.0, sum = 0.0;
int i = 0, len = 0;
Signal c(1 / dt, t_e - t_s);
len = c.get_len();
for (t = t_s, i = 0; t < t_e; t += dt, ++i) {
if (cnt && i % cnt == 0)
sum = 0.0;
sum += a.at_t(t) * b.at_t(t) * dt;
if (i < len)
c[i] = sum;
}
return c;
}
示例2: c
Signal Signal::operator+(const Signal& obj) const
{
unsigned length = 0;
double sfreq = 0.0, dura = 0.0;
assert(type != SIG_COS && obj.type != SIG_COS);
if (type == SIG_SAMP && obj.type == SIG_SAMP)
assert(samp_freq == obj.samp_freq && len == obj.len);
if (type == SIG_SAMP && obj.type == SIG_SAMP) {
length = len;
sfreq = samp_freq;
dura = duration;
} else if (type == SIG_SAMP) {
length = len;
sfreq = samp_freq;
dura = duration;
} else {
length = obj.len;
sfreq = obj.samp_freq;
dura = obj.duration;
}
Signal c(sfreq, dura);
for (unsigned i = 0; i < length; ++i) {
if (type == SIG_SAMP && obj.type == SIG_SAMP)
c.sample[i] = sample[i] + obj.sample[i];
else if (type == SIG_SAMP)
c.sample[i] = sample[i] + obj.at_t(i / obj.samp_freq);
else
c.sample[i] = at_t(i / samp_freq) + obj.sample[i];
}
return c;
}