Not sure it's trivial as this but "endif" is not a keyword in Julia.


> On Apr 6, 2015, at 9:05 AM, Jim Christoff <[email protected]> wrote:
> 
> First, Julia is a great replacement for Octave and in most cases "C". I have 
> used Octave for decades and Julia for a year or so. 
> I still have problems making the conversions. Any assistance will be greatly 
> appreciated.
> This is short example of the modified Octave code that I have tried to 
> convert. I realize there is a difference
> in how Julia handles arrays, but I don't seem to be able to resolve this 
> difference. 
> The following code I use in Octave:
> 
> function  arburg1 (x, p)
> 
> 
>   a = zeros(p)
>   n = length(x)
>   v = sum(x.*x)
> 
>   ## f and b are the forward and backward error sequences
>   f = x[2:n]
>   b = x[1:n-1]
> 
>   ## remaining stages i=2 to p
>   for i=1:p
> 
>     ## get the i-th reflection coefficient
>     g = 2 * sum(f.*b)/(sum(f.*f)+sum(b.*b));
>  
> 
>     ## generate next filter order
>     if i==1
>       a =  g  
>     else
>       a =   a-g*a[i-1:-1:1]   **** this is my problem area*****
>     endif
> 
>     ## keep track of the error
>     v = v*(1-g^2);
> 
>     ## update the prediction error sequences
>     oldf = f
>     f = oldf[2:n-i]- g*b[2:n-i]
>     b = b[1:n-i-1] - g*oldf[1:n-i-1]
> 
>   end
>   a =   -a[p:-1:1]
> 
> end
> 
> 
> Thanks for any suggestions

Reply via email to