mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-07-16 07:45:22 -04:00
Add methods to print filter taps as Matlab vectors
This commit is contained in:
parent
95b46937a7
commit
0c05e6dee2
@ -19,6 +19,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstdio>
|
||||||
#include "dsp/dsptypes.h"
|
#include "dsp/dsptypes.h"
|
||||||
#include "dsp/misc.h"
|
#include "dsp/misc.h"
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
@ -57,6 +58,19 @@ public:
|
|||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Print taps as a Matlab vector
|
||||||
|
void printTaps(const char *name)
|
||||||
|
{
|
||||||
|
printf("%s = [", name);
|
||||||
|
for (int i = 0; i <= m_taps.size() - 1; ++i) {
|
||||||
|
printf("%g ", m_taps[i]);
|
||||||
|
}
|
||||||
|
for (int i = m_taps.size() - 2; i >= 0; --i) {
|
||||||
|
printf("%g ", m_taps[i]);
|
||||||
|
}
|
||||||
|
printf("];\n");
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void init(int nTaps)
|
void init(int nTaps)
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#define INCLUDE_RAISEDCOSINE_H
|
#define INCLUDE_RAISEDCOSINE_H
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstdio>
|
||||||
#include "dsp/dsptypes.h"
|
#include "dsp/dsptypes.h"
|
||||||
|
|
||||||
// Raised-cosine low-pass filter for pulse shaping, without intersymbol interference (ISI)
|
// Raised-cosine low-pass filter for pulse shaping, without intersymbol interference (ISI)
|
||||||
@ -131,6 +132,19 @@ public:
|
|||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Print taps as a Matlab vector
|
||||||
|
void printTaps(const char *name)
|
||||||
|
{
|
||||||
|
printf("%s = [", name);
|
||||||
|
for (int i = 0; i <= m_taps.size() - 1; ++i) {
|
||||||
|
printf("%g ", m_taps[i]);
|
||||||
|
}
|
||||||
|
for (int i = m_taps.size() - 2; i >= 0; --i) {
|
||||||
|
printf("%g ", m_taps[i]);
|
||||||
|
}
|
||||||
|
printf("];\n");
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Real> m_taps;
|
std::vector<Real> m_taps;
|
||||||
std::vector<Type> m_samples;
|
std::vector<Type> m_samples;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user