Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Seitosh
Seitosh
Commits
7ea94bac
Commit
7ea94bac
authored
Jan 12, 2019
by
thomas.forbriger
Browse files
libpsdxx [WP]: provide LogIndex to reverse log-scale
parent
87885748
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/libpsdxx/helper.h
View file @
7ea94bac
...
...
@@ -43,6 +43,21 @@ namespace psd {
namespace
helper
{
/*! Class function to return index on logarithmic scale
*/
class
LogIndex
{
public:
LogIndex
(
const
double
&
f0
,
const
double
&
f1
,
const
double
&
f2
);
double
operator
()(
const
double
&
f
);
private:
double
Mn_per_decade
;
double
Mc
;
double
Mdf
;
};
// class LogIndex
}
// namespace helper
}
// namespace psd
...
...
src/libs/libpsdxx/log_index.cc
View file @
7ea94bac
...
...
@@ -34,11 +34,34 @@
"PSDXX_LOG_INDEX_CC V1.0"
#include
<psdxx/helper.h>
#include
<psdxx/error.h>
namespace
psd
{
namespace
helper
{
LogIndex
::
LogIndex
(
const
double
&
f0
,
const
double
&
f1
,
const
double
&
f2
)
{
PSDXX_assert
(
f1
>
f0
,
"frequency values must increase"
);
PSDXX_assert
(
f2
>
f1
,
"frequency values must increase"
);
Mdf
=
f0
;
double
logfac
=
(
f2
-
f1
)
/
(
f1
-
f0
);
Mn_per_decade
=
std
::
log
(
10.
)
/
std
::
log
(
logfac
);
Mc
=
(
f1
-
f0
)
/
(
f0
*
(
logfac
-
1.
));
}
// LogIndex::LogIndex(const double& f0,
// const double& f1,
// const double& f2)
/* ---------------------------------------------------------------------- */
double
LogIndex
::
operator
()(
const
double
&
f
)
{
double
l
=
Mn_per_decade
*
std
::
log
(
1.
+
((
f
/
Mdf
)
-
1.
)
/
Mc
)
/
std
::
log
(
10.
);
}
// double LogIndex::operator()(const double& f)
}
// namespace helper
}
// namespace psd
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment