[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:56:40 +0900 (JST) |
>>On Fri, Jun 10, 2016 at 5:49 AM, Lester Anderson 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
>>>>
> 15.417 16 176.5 193 2715 0.61 0.665 1
> 10.11 15.417 142 176.5 2671 0.342 0.532 1
> 9.805 10.11 137 142 2650 0.27 0.49 1
> 9.377 9.805 127 137 2710 0.71 0.7 1
> 8.752 9.377 112.2 127 2720 0.51 0.63 1
> 8.502 8.752 110 112.2 2710 0.71 0.7 1
> 7.735 8.502 98.9 110 2720 0.51 0.63 1
> 7.61 7.735 93.5 98.9 2710 0.71 0.7 1
> 7.31 7.61 83.5 93.5 2713 0.65 0.679 1
> 6.235 7.31 65 83.5 2709.5 0.474 0.609 1
> 5.01 6.235 55 65 2692 0.414 0.574 1
> 5.01 5.01 43 55 0 0 0 2
> 4.75 5.01 35.3 43 2669.469 0.337 0.529 2
> 4.15 4.75 31.1 35.3 2685 0.39 0.56 2
> 3.15 4.15 23.8 31.1 2685 0.39 0.56 2
> 2 3.15 12.7 23.8 2678 0.366 0.546 2
> 0 2 5.4 12.7 2679 0.372 0.55 2
The separator is tab.
load command requires header which describe variable information like
#
Created by Octave 3.6.4, Fri Feb 14 16:11:23 2014 JST <address@hidden>
#
name: xydata
#
type: matrix
#
rows: 11
#
columns: 2
0
0
0.6283185307179586
0.5877852522924731
1.256637061435917
0.9510565162951535
1.884955592153876
0.9510565162951536
2.513274122871835
0.5877852522924733
3.141592653589793
1.224646799147353e-016
3.769911184307752
-0.587785252292473
4.39822971502571
-0.9510565162951535
5.026548245743669
-0.9510565162951536
5.654866776461628
-0.5877852522924734
6.283185307179586
-2.449293598294706e-016
Please use "dlmread" instead.
(For detail see >> help dlmread)
Tatsuro
- [no subject], Lester Anderson, 2016/06/09
- Re: (no subject), siko1056, 2016/06/09
- Re: (no subject), Lester Anderson, 2016/06/10
- Re: (no subject), siko1056, 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),
Tatsuro MATSUOKA <=
- 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, 2016/06/10