Home Forums HTBasic Forum Need help with HTBasic code

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5287
    Anonymous

      I have this code:

      X=C+1! STARTS MATRIX ANALYSIS
      Y=C+2
      ALLOCATE Ya(Y,Y),Za(Y,Y)
      MAT Za=(0)
      REDIM Qa(Y)
      MAT Qa=(0)
      REDIM Xa(Y)
      FOR I=1 TO No
      L=D(I*2-1)
      R=D(I*2)
      Qa(L)=Qa(L)+Obs(1,I)
      Qa(R)=Qa(R)-Obs(1,I)
      Za(L,L)=Za(L,L)+1
      Za(R,R)=Za(R,R)+1
      Za(L,R)=Za(L,R)-1
      Za(R,L)=Za(R,L)-1
      Za(X,L)=Za(X,L)+1
      Za(L,X)=Za(X,L)
      Za(X,R)=Za(X,R)-1
      Za(R,X)=Za(X,R)
      Za(X,X)=Za(X,X)+1
      Qa(X)=Qa(X)+Obs(1,I)
      NEXT I
      FOR I=1 TO C
      Za(Y,I)=Cel(4,I)
      Za(I,Y)=Cel(4,I)
      NEXT I
      MAT Ya=INV(Za)
      MAT Xa=Ya*Qa
      DEALLOCATE Ya(*),Za(*)
      W=0
      FOR I=1 TO No
      L=D(I*2-1)
      R=D(I*2)
      Wa(I)=Obs(1,I)-(Xa(L)-Xa(R)+Xa(X))
      W=W+Wa(I)^2
      NEXT I
      Stddev=SQR(ABS(W/(No-C)))
      Ab_comp=Xa(C+1)

      where C = 4, and No = 6

      can anyone help, to disassemble or understand. As I understand it, the matrix is compiled here

      #5290
      ZeRider
      Participant

        Hi,
        Advice : Add some PRINT in your code to see the different data values at each step
        You will see if data are extracted from array well defined in your code : For example, L=D(I*2-1) and R=D(I*2) are always 0 (?)
        or if array dimensions are compatible with your loop …

        #5292
        Anonymous

          yes, i have 0 for L and R

          #5293
          Anonymous

            and add this code to the begining

            C=4
            RESTORE C0
            IF C=3 THEN RESTORE C3
            IF C=4 THEN RESTORE C4
            C0: DATA 0
            C3: DATA 6,1,2,1,3,2,3,2,1,3,1,3,2
            C4: DATA 12,1,2,1,3,2,3,2,4,3,4,3,1,3,2,4,2,4,1,4,3,2,1,1,4
            READ No
            FOR I=1 TO No
            READ D(2*I-1),D(2*I)
            NEXT I

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.
          Scroll to Top
          HTB icon

          Please Sign In