help-octave
[Top][All Lists]
Advanced

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

Getting Matlab geophysics code running in Octave


From: Lester Anderson
Subject: Getting Matlab geophysics code running in Octave
Date: Sun, 4 Aug 2013 11:17:19 +0100

Hello,

I have an issue getting some Matlab code running in Octave (3.6.4) and have managed to get part way into the problems, but it is still not functioning as expected, i.e. the output is not coming up for one.

A lot of code has - defval('T',35e3) for example, so I just changed lines like that to T=35e3, however I am not sure this is the intention?

Other times I have seen code written like here:

% Te=[40 30 20 10 5 0]; <----------------------------  user input of Te values as a vector
% [l,Zb,G2b]=mckenzie([0 2670 2670+670],[0 35],[1 0],Te(4)); % Top loading
% [l,Zb,G2b]=mckenzie([0 2670 2670+670],[0 35],[0 1],Te(4)); % Bottom loading
%
% See FORSYTH, MCKENZIE1, MCKENZIE2, LOADING
%
% Last modified by fjsimons-at-alum.mit.edu, October 21st, 2003

defval('R',[1030 2600 2900 3300])
defval('T',[      0     15   35])
defval('F',[    0.6    0.4    0])
defval('Te',17)   <----------------------  A value of Te is given here, but above a range of values is given!
defval('E',1.4e11);
v=0.25;
g=9.81;

Again, I can change the defav to R=[......], and it will plot sometimes, bu only one value (in this case Te=17 and not the range [40 30 20 10 5 0].

I am not an expert on Matlab, but there are obvious differences with Octave (and Scilab too). I would be grateful if I could get help to get the attached code to run and generate the output (image - coheref2.gif). The code is freely available at: http://geoweb.princeton.edu/people/simons/software.html.

The function coheref2.m calls forsyth.m and both are attached in the original Matlab.

The lines like:
  defval('g',fralmanac('GravAcc'));
  G=fralmanac('GravCst'); % calls a file with a load of constants
can be replaced with the constants:
g=9.81 % gravity acceleration
G=6.67e-11 % Universal gravitational constant
The big advantage of Octave over Scilab, is that generally most code will run straight "out of the box" whereas in Scilab it has to be converted (and tweaked).

If I can see how it should be written then it will be easier for me to sort the rest :)
Thanks for any help and guidance, apologies for the long-winded query.

Cheers

Lester

Attachment: coheref2.m
Description: Binary data

Attachment: forsyth.m
Description: Binary data

Attachment: coheref2.gif
Description: GIF image


reply via email to

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