piccolbo/Pweave

View on GitHub
doc/examples/octave_sample.mdw

Summary

Maintainability
Test Coverage

# Using Octave with Pweave

You can also use Pweave to publish reports using GNU Octave or Matlab. The
was  released with Pweave 0.23.

**Features:**

* Inline code and noweb style chunks
* Capturing of figures

**Limitations**

* No terminal chunks
* Only one figure/chunk

You can use inline code chunks like in Python documents:

Give y value 300 <%y=300;%> in hidden chunk.

And let's verify that it worked:

<<>>=
y
@

You can also display the result from inline chunk 2+5=<%=2+5%>

## Solving least squares


and trying out plotting features:

<<fig=True>>=
x = (0:25) + randn(1, 26);
y = linspace(0, 5, length(x));
a = x' \ y'
plot(x , y, 'o')
hold on
plot(x, a*x, 'r')
hold off
figure()
hist(a*x - y)
title('Histogram of residuals')
@

And include a plot but hide the code:

<<fig=True, echo=False, caption="Sinc function">>=
x = linspace(0, 4*pi, 200);
plot(x, sinc(x), 'linewidth', 1)
hold on
plot(x, sinc(0.7*x), 'g', 'linewidth', 1)
hold off
xlabel('x')
ylabel('sinc(x)')
@