octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #62289] Parse error after end of code


From: anonymous
Subject: [Octave-bug-tracker] [bug #62289] Parse error after end of code
Date: Mon, 11 Apr 2022 10:12:41 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?62289>

                 Summary: Parse error after end of code
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Mon 11 Apr 2022 02:12:39 PM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: Alex W
        Originator Email: wohlgemuth.6@gmail.com
             Open/Closed: Open
                 Release: 6.4.0
         Discussion Lock: Any
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

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!




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62289>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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