bugGNU Octave - Bugs: bug #62289, Parse error after end of code

 
 

bug #62289: Parse error after end of code

Submitter:  None
Submitted:  Mon 11 Apr 2022 02:12:39 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Alex W Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 6.4.0
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 11 Apr 2022 02:34:42 PM UTC, comment #2: 

You probably tried to match "while" with "Endfor" (which isn't even a keyword in Octave). So, Octave's parser complains because it still expects a closing tag when it reaches the end of the file.

Like Dmitri already wrote: This is a bug tracker. You are welcome to ask any kind of Octave related question on the discourse forum.

Closing as invalid.

Markus Mützel <mmuetzel>
Group administrator
Mon 11 Apr 2022 02:22:53 PM UTC, comment #1: 

What you posted is not a bug report. if you need help please post on https://octave.discourse.group/

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Mon 11 Apr 2022 02:12:39 PM UTC, original submission:  

Hi, I have code that is 74 lines in length, and when running, get an error:

error: parse error near line 75 of file (my code)

  syntax error

Obviously this shouldn't be possible as the error is occurring after the end of the code.

Here is my code:

%Transient code using 4th order Runge-Kutta methods

pkg load io
pkg load symbolic

%Read in all constants
Y_H = xlsread('ASM1 inputs for Octave.xlsx','Constants','B1');
mu_H = xlsread('ASM1 inputs for Octave.xlsx','Constants','B6');
K_s = xlsread('ASM1 inputs for Octave.xlsx','Constants','B7');
b_LH = xlsread('ASM1 inputs for Octave.xlsx','Constants','B10');


%Read in all tank conditions
Q = xlsread('ASM1 inputs for Octave.xlsx','Tank Conditions','B1');
V_tot = xlsread('ASM1 inputs for Octave.xlsx','Tank Conditions','B2');
R = xlsread('ASM1 inputs for Octave.xlsx','Tank Conditions','B3');
Q_R = xlsread('ASM1 inputs for Octave.xlsx','Tank Conditions','B4');
tau = xlsread('ASM1 inputs for Octave.xlsx','Tank Conditions','B5');
SRT = xlsread('ASM1 inputs for Octave.xlsx','Tank Conditions','B6');
Num_tanks = xlsread('ASM1 inputs for Octave.xlsx','Tank Conditions','B7');

%Read in all influent values
S_si = xlsread('ASM1 inputs for Octave.xlsx','Influent','B2');
X_bi = xlsread('ASM1 inputs for Octave.xlsx','Influent','B5');

RelTol = 0.000001;
AbsTol = 0.000000001;

%Pre-allocate matrices for RK calculations
Diff = zeros(2,1);
k1 = zeros(2,1);
k2 = zeros(2,1);
k3 = zeros(2,1);
k4 = zeros(2,1);

%Initial conditions in the tank
S_s(1) = S_si/10;
X_b(1) = 1500;
S_o = 2;
X_br(1) = (X_b(1) + X_b(1) * R) / R;

%Step size
h = 4;

%Setting max diff to an arbitrarily large number
MaxDiff = 1000000;
m = 1;
  while (MaxDiff > RelTol)
        %Runge-Kutta calculations
        k1(1) = (mu_H*S_s(m) / (K_s + S_s(m)) *X_b(m)) - b_LH*X_b(m) + (Q*X_bi + Q_R *X_br(m) - (Q+Q_R)*X_b(m))/V_tot;

        k1(2) = ((-1/Y_H)*mu_H*S_s(m) / (K_s + S_s(m))) * (X_b(m)) + (Q*S_si + Q_R * S_s(m) - (Q+Q_R)*S_s(m))/V_tot;

        k2(1) = mu_H*(S_s(m) + k1(2) * h/2) / (K_s + (S_s(m) + k1(2) * h/2)) *(X_b(m) + h*k1(1) /2) - b+LH *(X_b(m) + h(k1(1) /2)) + (Q*X_bi + Q_R*X_br(m) - (Q+Q_R)*X_b(m) + h*k1(1) /2 )/V_tot;

        k2(2) = (-1/Y_h)*mu_H*(S_s(m) + k1(2) * h/2) / (K_s + (S_s(m) + k1(2) * h/2)) *(X_b(m) + k1(2) *h/2) + (Q*S_si + Q_R*(S_s(m) + k1(2)*h/2) - (Q+Q_R)*(S_s(m) + k1(2)*h/2))/V_tot;

        k3(1) = (mu_H*S_s(m) + k2(2) *h/2)/(K_s + S_s(m) + k2(2) * h/2) *(X_b(m) + h*k2(1)/2) - b_LH *(X_b(m) + h*k2(1)/2) + (Q*X_bi + Q_R * X_br(m) - (Q + Q_R)*(X_b(m) + h*k2(1)/2))/V_tot;

        k3(2) = (-1/Y_H)*mu_H*(S_s(m) + k2(2) * h/2) /(K_s + (S_s(m) + k2(2)*h/2)) *(X_b(m) + k2(1) *h/2) + (Q*S_si + Q_R* (S_s(m) + k2(2) * h/2) - (Q+Q_R) *(X_b(m) + h*k3(1)))/V_tot;

        k4(1) = mu_H *(S_s(m) + k3(2) *h)/(K_s + (S_s(m) + k3(2) * h))*(X_b(m) + h *k3(1)) - b_LH*(X_b(m) + h*k3(1)) + (Q*X_bi + Q_R*X_br(m) - (Q+Q_R) *(X_b(m) + h*k3(1)))/V_tot;

        k4(2) = (-1/Y_H)*mu_H*(S_s(m) + k3(2)*h)/(K_s + (S_s(m)+k3(2)*h))*(X_b(m) + k3(1) * h) + (Q*S_si + Q_R *(S_s(m) + k3(2) *h) - (Q+Q_R)*(S_s(m) + k3(2) * h))/V_tot;

        X_b(m+1) = X_b(m) + 1/6*(k1(1) + 2*k2(1) + 2*k3(1) + k4(1)) *h;
        S_s(m+1) = S_s(m) + 1/6 *(k1(2) + 2*k2(2) + 2*k3(2) + k4(2))*h;
        Diff(1) = X_b(m+1) - X_b(m);
        Diff(2) = S_s(m+1) - S_s(m);
        X_br(m+1) = (X_b(m+1) + X_b(m+1)*R)/R;

        MaxDiff = max(abs(Diff)); %use this to determine if the solution has converged
        m = m+1;
  Endfor


I'm not sure what's going on in this case, but would appreciate any suggestions. Thanks!

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-04-11 mmuetzel StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code