Browse Source

Add methods to print filter taps as Matlab vectors

chirpmodem-v8.0.0
Jon Beniston 4 years ago
parent
commit
0c05e6dee2
  1. 14
      sdrbase/dsp/firfilter.h
  2. 14
      sdrbase/dsp/raisedcosine.h

14
sdrbase/dsp/firfilter.h

@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
#pragma once
#include <cmath>
#include <cstdio>
#include "dsp/dsptypes.h"
#include "dsp/misc.h"
#include "export.h"
@ -57,6 +58,19 @@ public: @@ -57,6 +58,19 @@ public:
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:
void init(int nTaps)
{

14
sdrbase/dsp/raisedcosine.h

@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@
#define INCLUDE_RAISEDCOSINE_H
#include <cmath>
#include <cstdio>
#include "dsp/dsptypes.h"
// Raised-cosine low-pass filter for pulse shaping, without intersymbol interference (ISI)
@ -131,6 +132,19 @@ public: @@ -131,6 +132,19 @@ public:
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:
std::vector<Real> m_taps;
std::vector<Type> m_samples;

Loading…
Cancel
Save