[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
unorthodox usage
From: |
Jonathan Murphy |
Subject: |
unorthodox usage |
Date: |
Wed, 21 Dec 2005 14:54:42 -0500 |
User-agent: |
Mozilla Thunderbird 1.0.6 (X11/20051214) |
Hi folks,
I am trying to use octave to produce matrices for use with Csound
scanned synthesis opcodes. For the curious, the relevant documentation
can be found here:
http://www.csounds.com/manual/html/SiggenScanTop.html
The opcode loads its data from an ASCII file consisting of a binary
string which expresses the connections in a table. For a table which
looks like this:
| 1 | 2 | 3 | 4 |
------------------------
1 | 0 | 1 | 0 | 0 |
------------------------
2 | 0 | 0 | 1 | 0 |
------------------------
3 | 0 | 0 | 0 | 1 |
------------------------
4 | 0 | 0 | 0 | 0 |
------------------------
The file should look like this:
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
I don't need octave to actually save the file, just print the string to
stdout, presumably disp is the best way to do this. I came across a
toolbox here:
http://mathphys.physics.kth.se/index.html
which will produce amongst other things an approximation of the Cornu
spiral.
function f=fresn(X);
%> Call: fresn(X) = the complex Fresnel function C(X) + i S(X)
%> Input: X is a real vector or matrix
%> Output: fresn(X) is complex of the same dimension.
%> For definitions and values of constants, see
%> Mark A. Heald, Math. Comp. 44(170), 459-461 (1985)
%> and HMF Chap 7.
%> This is a rational approximation with limited accuracy!
%>
%> © Goran Lindblad - address@hidden
SX=sign(X); X=abs(X);%
aa=[.0241212,.068324,.2363641,.1945161,1];
bb=[.118247,.356681,.978113,1.875721,2.7570246,2.9355041,2];
cc=[.0433995,.1339259,.3460509,.6460117,.7769507,1];
dd=[.13634704,.4205217,1.0917325,1.9840524,2.7196741,2.5129806,sqrt(2)];
Rx=polyval(cc,X)./polyval(dd,X);
Ax=(polyval(aa,X)./polyval(bb,X) -X.^2)*pi/2;
Cx=.5 - Rx.*sin(Ax);Sx=.5 - Rx.*cos(Ax);
f=SX.*(Cx+i*Sx);
Is there a way to convert the output of this function (or octave
functions in general) to the binary ASCII format that the Csound opcodes
require?
Thanks in advance,
Jonathan.
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- unorthodox usage,
Jonathan Murphy <=