help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running Octave through a WWW server


From: Ray Anderson
Subject: Re: Running Octave through a WWW server
Date: Wed, 3 Dec 1997 12:30:54 -0800 (PST)

I don't think the question posed in the attached message has been answered
fully, so here is my input.

I am running an application similar to the one described in the original
question where I convert the binary output from an Hspice simulation run to a 
.mat file. Then I 
read the .mat file into octave, perform some manipulation of the data matrices 
and output a .gif 
file to be displayed on the users web browser.

I had the same problem as described by the author of the original message:
It worked fine when executed from the command line but produced no gif
file when executed via the web interface.


In my case I found that there was no path information for octave to find
gnuplot when the cgi script was calling it. The solution was to add a line
to the cgi script to explicity set a path to the gnuplot binary before
invoking octave. Everything works as intended after that fix.



~


Ray Anderson

address@hidden


------------- Begin Forwarded Message -------------

Resent-Date: Thu, 20 Nov 1997 13:56:19 -0600
X-Sender: address@hidden
Date: Thu, 20 Nov 1997 13:52:11 -0600
To: address@hidden
From: "W. Jarrett Campbell" <address@hidden>
Subject: Running Octave through a WWW server
Mime-Version: 1.0
Resent-Message-ID: <"T7yFwNdVWoI.A.v1G.jXJd0"@bevo.che.wisc.edu>
Resent-From: address@hidden
X-Mailing-List: <address@hidden> 
X-Loop: address@hidden
Resent-Sender: address@hidden

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

------------- End Forwarded Message -------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]