- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Vector/Matrix operation
Page Start Prev 1 Next End
Vector/Matrix operation
Vector/Matrix operation
Jun-30-10 14:03:48
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
Jul-01-10 08:18:54
Nothing is wrong with the code. OpenModelica just has problems with counting equations for array assignments in algorithm sections.
- sjoelund.se
- 1700 Posts
Page Start Prev 1 Next End
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Vector/Matrix operation
There are 0 guests and 0 other users also viewing this topic