[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting Matlab geophysics code running in Octave
From: |
Ben Abbott |
Subject: |
Re: Getting Matlab geophysics code running in Octave |
Date: |
Sun, 04 Aug 2013 12:06:23 -0400 |
On Aug 4, 2013, at 12:02 PM, Juan Pablo Carbajal wrote:
> On Sun, Aug 4, 2013 at 12:17 PM, Lester Anderson <address@hidden> wrote:
>> 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
>
> Checking mathworks help I can't find a function "defval" (though it
> may be due to my horrible connection and their heavy site). If you do
> not find the help of a defval function it means the person who created
> the package you want to use has it. In that case is not a Matlab -
> Octave problem but just that the code you received is incomplete or
> the paths are not well defined.
>
> Please double check. If you find a mathworks defval let us know what
> it does and we can suggest alternatives or implement it.
>
> Cheers
From Matlab ..
which defval
'defval' not found.
Ben
- Getting Matlab geophysics code running in Octave, Lester Anderson, 2013/08/04
- Re: Getting Matlab geophysics code running in Octave, Juan Pablo Carbajal, 2013/08/04
- Re: Getting Matlab geophysics code running in Octave,
Ben Abbott <=
- Re: Getting Matlab geophysics code running in Octave, c., 2013/08/04
- Re: Getting Matlab geophysics code running in Octave, Ben Abbott, 2013/08/04
- Re: Getting Matlab geophysics code running in Octave, Lester Anderson, 2013/08/04
- Re: Getting Matlab geophysics code running in Octave, Juan Pablo Carbajal, 2013/08/04
- Re: Getting Matlab geophysics code running in Octave, Juan Pablo Carbajal, 2013/08/04
- Re: Getting Matlab geophysics code running in Octave, Lester Anderson, 2013/08/04
- Re: Getting Matlab geophysics code running in Octave, Juan Pablo Carbajal, 2013/08/04