Skip to main content

Posts

Showing posts with the label GNU Octave

GNU Octave from PHP without temp files

Of course... How haven't I thought that? Pipes! I was "googling" about PHP and Octave and I had found some simple approach at a m ailing list archive . I had already used Octave with PHP but I had always used temporary files, but pipes are a much simpler approach. From the mailing list post: in php start "octave -q script" with popen create a string in php e.g. "input_data = [102 10 10 10 10 10];" write this string to the pipe in octave recive the string with fread on stdin let the eval function do the job calculate print the result with printf in php syntax "$result = array(12,10,9,12,)" php read the output from the pipe (with php fread) use phps eval function but using eval with octave and php is a security risk, to avid eval parse the matrix wird scanf this is also not the fastes way to use octave (the octave startup needs a lot of time)

EIDORS

EIDORS: Electrical Impedance Tomography and Diffuse Optical Tomography Reconstruction Software http://eidors3d.sourceforge.net/ This was found at: http://web.me.com/chibaf/math/octave/ Apparently, EIDORS works with both, matlab and octave. I have to remember to also check https://staff.ti.bfh.ch/sha1/fem.html

PHP + GNU Octave to build a web based pump dimensioning system

During my undergrad studies, when I was doing the fluid dynamics class, we had to dimension pumping systems. The work involved in doing that used to be laborious, many coefficients, constants, etc, and we had to use only our scientific calculators. To check our answers when in home, everybody used to wrote their own spreadsheet. As a FLOSS enthusiast and long time PHP programmer, I decided to write a web based pump dimensioning system. As we calculated the fluid density depending on watter temperature, and we had used small numbers (E-5) which lead to underflow errors when the calculations were did using only PHP statements. In other hand, when using GNU Octave, the precision was great and things were much easy, because I didn't really needed to care about precision, was just type the calculations, press enter and get the right answer. So I wrote a PHP function that calls the exec command to run GNU Octave and get back the Octave output into one PHP variable. That way I got all cal...