Can Simscape domains be defined with vectors?
Show older comments
Hello,
I am working on creating a custom Simscape domain and I am trying to determine if I can define both my Through and Across variables in terms of vectors. I understand that according to this following post, Simscape can handle vector and matrix equations but its not clear if the variables may be defined in the domain this way:
I'd like to basically define something along the lines of this:
variables
R = { [0;0] , 'W/sr' };
end
variables(Balancing = true)
Q = { [0;0] , 'W' };
end
This would lead to matrix operations in my component's equations so I don't feel simulation speed will improve due to lesser nodes but it will be easier to follow on the block diagram and clear.
Is this possible?
1 Comment
cmmcnamara
on 15 Aug 2020
Answers (1)
Yifeng Tang
on 21 Aug 2020
0 votes
Yes. It's possible. I wonder where you find the quoted code, because I've been using [0;0;0] format not knowing it's OK the other way, too.
For these vector variables or parameters, you may functions like sum and dot to perform vector manipulations. You can also use syntax like V(1) or V(3:end) to define equations on specific components. If I manage to find more complete documentation on this, I'll post again.
Whenever I'm not sure how I should write the equations for the vector variables, I found it convenient to try things out in PS first. PS constant can be vectors, too. So I can write blocks in PS domain and have a scope to look at them. If things all behave as expected, I would implement the equations in the actual domain.
Hope this helps.
Yifeng
1 Comment
cmmcnamara
on 21 Aug 2020
Categories
Find more on Foundation and Custom Domains in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!