Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Vector/Matrix operation

Vector/Matrix operation

Hello,
I am a new openmodelica user.
I try to write vector/matrix operations in algorithm section.
For example:

Code:

class mvmul

  Real res[3];
  Real m[3,3]={{1,0,0},{0,0.5,0},{0,0,1}};
  Real v[3]={1,1,1};
  algorithm
  res:=m*v;
end mvmul;

After "Check":

Code:

Class mvmul has 13 equation(s) and 15 variable(s). 12 of these are trivial equations.

After "Simulate" :

Code:

{"",""}

"Error: Too few equations, underdetermined system. The model has 1 equation(s) and 3 variable(s)
"

Result of 'm*v' has dimension [3] and res[3]. But system interpreted 'm*v' dimension as [1].
what is wrong in my code?

Thank you.

Re: Vector/Matrix operation

Nothing is wrong with the code. OpenModelica just has problems with counting equations for array assignments in algorithm sections.

Re: Vector/Matrix operation

Thanks for the answer. I hope a problem in due course it will be resolved.

There are 0 guests and 0 other users also viewing this topic