mirror of https://github.com/mpastell/Weave.jl
Fix to script reader
parent
a9d0120c3d
commit
ec00702fe0
|
@ -158,7 +158,6 @@ function parse_doc(document::AbstractString, format::ScriptInput)
|
|||
line = replace(line, " ", "", 1)
|
||||
end
|
||||
if state == "code" && strip(read) != ""
|
||||
push!(parsed, chunk)
|
||||
chunk = CodeChunk("\n" * rstrip(read), codeno, start_line, optionString, options)
|
||||
push!(parsed, chunk)
|
||||
codeno +=1
|
||||
|
|
|
@ -31,39 +31,6 @@ DSP.jl package doesn't (yet) have a method to calculate the
|
|||
the frequency response of a FIR filter so we define it:
|
||||
|
||||
|
||||
% FIR filter design with Julia
|
||||
% Matti Pastell
|
||||
% 21th April 2016
|
||||
|
||||
# Introduction
|
||||
|
||||
This an example of a julia script that can be published using
|
||||
[Weave](http://mpastell.github.io/Weave.jl/latest/usage/).
|
||||
The script can be executed normally using Julia
|
||||
or published to HTML or pdf with Weave.
|
||||
Text is written in markdown in lines starting with "`#'` " and code
|
||||
is executed and results are included in the published document.
|
||||
|
||||
Notice that you don't need to define chunk options, but you can using
|
||||
`#+`. just before code e.g. `#+ term=True, caption='Fancy plots.'`.
|
||||
If you're viewing the published version have a look at the
|
||||
[source](FIR_design.jl) to see the markup.
|
||||
|
||||
|
||||
# FIR Filter Design
|
||||
|
||||
We'll implement lowpass, highpass and ' bandpass FIR filters. If
|
||||
you want to read more about DSP I highly recommend [The Scientist
|
||||
and Engineer's Guide to Digital Signal
|
||||
Processing](http://www.dspguide.com/) which is freely available
|
||||
online.
|
||||
|
||||
## Calculating frequency response
|
||||
|
||||
DSP.jl package doesn't (yet) have a method to calculate the
|
||||
the frequency response of a FIR filter so we define it:
|
||||
|
||||
|
||||
~~~~{.julia}
|
||||
using Gadfly, DSP
|
||||
|
||||
|
@ -85,18 +52,6 @@ end
|
|||
|
||||
|
||||
|
||||
## Design Lowpass FIR filter
|
||||
|
||||
Designing a lowpass FIR filter is very simple to do with DSP.jl, all you
|
||||
need to do is to define the window length, cut off frequency and the
|
||||
window. We will define a lowpass filter with cut off frequency at 5Hz for a signal
|
||||
sampled at 20 Hz.
|
||||
We will use the Hamming window, which is defined as:
|
||||
$w(n) = \alpha - \beta\cos\frac{2\pi n}{N-1}$, where $\alpha=0.54$ and $\beta=0.46$
|
||||
|
||||
|
||||
|
||||
|
||||
## Design Lowpass FIR filter
|
||||
|
||||
Designing a lowpass FIR filter is very simple to do with DSP.jl, all you
|
||||
|
@ -118,11 +73,6 @@ h = FIRfreqz(f, w)
|
|||
|
||||
|
||||
|
||||
## Plot the frequency and impulse response
|
||||
|
||||
The next code chunk is executed in term mode, see the [script](FIR_design.jl) for syntax.
|
||||
|
||||
|
||||
## Plot the frequency and impulse response
|
||||
|
||||
The next code chunk is executed in term mode, see the [script](FIR_design.jl) for syntax.
|
||||
|
|
Loading…
Reference in New Issue