[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (no subject)
From: |
Tatsuro MATSUOKA |
Subject: |
Re: (no subject) |
Date: |
Fri, 10 Jun 2016 19:45:02 +0900 (JST) |
> 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
>>
>>
>>
> From: Lester Anderson
> To: siko1056
> Cc: help-octave
> Date: 2016/6/10, Fri 18:49
> Subject: Re: (no subject)
>
> 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
> 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
>
>
Please "do not" the top posting on this list.
Bottom posting is a custom on this list.
What version octave do you use?
Octave 4 with GUI?
If it is the case, what Marrix A is represented in the workspace browser.
I suspect that load file is not valid.
Tatsuro
- Re: (no subject), (continued)
- Re: (no subject), Tatsuro MATSUOKA, 2016/06/10
- Re: (no subject), Doug Stewart, 2016/06/10
- Re: (no subject), Lester Anderson, 2016/06/10
- Re: (no subject), Lester Anderson, 2016/06/10
- Re: (no subject), Doug Stewart, 2016/06/10
- Re: (no subject), Lester Anderson, 2016/06/10
- Re: (no subject), Doug Stewart, 2016/06/10
- Re: (no subject), Doug Stewart, 2016/06/10
- Re: (no subject), Lester Anderson, 2016/06/10
- Re: (no subject), Francesco Potortì, 2016/06/10
- Re: (no subject),
Tatsuro MATSUOKA <=
- Re: (no subject), Francesco Potortì, 2016/06/10