[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Running Octave through a WWW server
From: |
W. Jarrett Campbell |
Subject: |
Running Octave through a WWW server |
Date: |
Thu, 20 Nov 1997 13:52:11 -0600 |
I just signed up to this list so please forgive me if a similar item has
been discussed before. I'm currently working on a project that works as
follows:
1. Submit parameter values over a WWW form
2. a PERL/CGI script parses the data, opens OCTAVE and pipes in the data
3. OCTAVE opens an m-file, uses the data and lsode to solve some diff. eqs.
4. OCTAVE output a plot as a pbm file using gnuplot
5. ppmtogif is used to convert the pbm to gif format
6. The output is displayed in a web browser.
I successfully have done this using MATLAB/GNUPLOT but I am having some
difficulty with the OCTAVE implementation.
When I run the cgi script from the unix command line, everything works
fine. But when I call the cgi from the web browser, my pbm and gif files
have file size 0 (zero). I expect it has something to do with permissions,
but can't solve the mystery. Yes, the output directories have 777
permissions (like I said, it works with MATLAB).
Here's a list of commands being sent to OCTAVE through the pipe:
set term pbm
set output "$output_ppm"
cd $mfiles
A0=$A0;
A1=$A1;
A2=$A2;
B0=$B0;
B1=$B1;
B2=$B2;
B3=$B3;
w=$w;
K=$K;
pilot;
exit
where $XX are previously defined perl variabless and pilot is my m-file
(below)
global A2 A1 A0 B0 B1 B2 B3 K w
function xdot2=f2(x,t)
global A2 A1 A0 B0 B1 B2 B3 K w
xdot2(1)=x(2);
xdot2(2)=-A1/A2*x(2)-A0/A2*x(1)+K/A2*(B0+B1*t+B2*t^2+B3*sin(w*t));
endfunction
function xdot1=f1(x,t)
global A2 A1 A0 B0 B1 B2 B3 K w
xdot1(1)=-A0/A1*x(1)+K/A1*(B0+B1*t+B2*t^2+B3*sin(w*t));
endfunction
if A2 == 0
taut = 10*A1/A0;
x = lsode("f1", [0], (t = linspace (0, taut, 200)'));
y = x;
else
taut = 10*sqrt(A2);
x = lsode("f2", [0; 0], (t = linspace (0, taut, 200)'));
y = x(:,1);
end
set title "Dynamic Response"
set xlabel "Time"
set ylabel "Output"
set border
set nogrid
set nokey
plot(t,y)
Also, when just using GNUPLOT, I can use the size property to scale the
image. But in OCTAVE, size has another meaning. Is there some way to
scale the output?
Any help would be greatly appreciated.
Jarrett Campbell
address@hidden
- Running Octave through a WWW server,
W. Jarrett Campbell <=