help-octave
[Top][All Lists]
Advanced

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

Re: (no subject)


From: Doug Stewart
Subject: Re: (no subject)
Date: Fri, 10 Jun 2016 06:37:51 -0400



On Fri, Jun 10, 2016 at 5:49 AM, Lester Anderson <address@hidden> wrote:
Hi Kai,

Thanks for the info and the code tweak; seems to be ok for one
function. Basically trying to get a public-domain code to run
(http://www.ux.uis.no/~nestor/work/matlabScripts.html) and
specifically 1D Airy backstrip.

With your code tweak it seems to run, but I am not sure it is reading
the datafile, which should create a 2D matrix (A), however A() does
not show up in the list of variables.

%read parameters from a txt file

[datafile] = uigetfile('*.txt','Choose a txt file');
A=load(datafile); <- this should be fine
these 2 lines work for me.
Maybe your txt file does not have 8 coulombs?


 
zt = A(:,1);
zb = A(:,2);
agetop = A(:,3);
agebas = A(:,4);
psed = A(:,5);
c = A(:,6);
surpor = A(:,7);
basset = A(:,8);

flagfile = 1;
flagunits = 1;
flagage = 1;
flagdens = 1;
flagporo = 1;

Running the code :
>> backstrip
>> error: water: A(I): index out of bounds; value 2 out of bound 1 - suspect this is because the matrix A is not loaded?
error: called from
    water at line 55 column 19

Leste



On 10 June 2016 at 09:13, siko1056 <address@hidden> wrote:
> Dear Lester,
>
> Yes this behavior of fzero, passing extra arguments, in Matlab is known [1],
> e.g. Matlab allows:
>
> mysin = @(x,a,b) a*sin(x)+b
> fzero (mysin, 1, [], 2, 0.2)
>
> Octave doesn't. Matlab still supports this behavior maybe for legacy reason,
> but does not document this and recommends using other methods [2], that
> Octave supports as well. For your Example:
>
> allequ2 = @(x) allequ(x,Y1(j,i),zb(j),zt(j),surpor(j),c(j));
> yy = fzero(allequ2,Y2(j,i),options);
>
> HTH, Kai
>
>
> [1]
> http://octave.1599824.n4.nabble.com/passing-parameters-to-fzero-fsolve-td1637028.html
> [2] https://www.mathworks.com/help/matlab/ref/fzero.html#inputarg_fun
>
>
>
> --
> View this message in context: http://octave.1599824.n4.nabble.com/no-subject-tp4677559p4677590.html
> Sent from the Octave - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave

_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave



--
DASCertificate for 206392


reply via email to

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