How to simulate the matrix in Simulink

2 次查看(过去 30 天)
Dear everyone, I have matrix that has variable in it and I need multiply this matrix with vector that also has variable. How can I do that? fox example [ 1-q0 -0.5q1c -0.5q1s; -q1c 1-q0 0;q1s 0 1-q0]*[vc0;vc1;vc2]
q0,q1c,q1s,-q1c,vc0;vc1;vc2 are variables

回答(1 个)

Akhilesh Mishra
Akhilesh Mishra 2017-7-11
I am not sure of what do you mean by simulating a matrix in Simulink. If you just want to multiply the matrix with a vector having variables, it can be done in the MATLAB command window by entering the following commands-
>> syms q0 q1c q1s vc0 vc1 vc2
>> [ 1 - q0 -0.5*q1c -0.5*q1s; -q1c 1 - q0 0;q1s 0 1 - q0]*[vc0;vc1;vc2]
ans =
- (q1c*vc1)/2 - (q1s*vc2)/2 - vc0*(q0 - 1)
- q1c*vc0 - vc1*(q0 - 1)
q1s*vc0 - vc2*(q0 - 1)
The resulting answer is a 3x1 vector as expected. Please note the 'syms' command is a function of Symbolic Math Toolbox, details provided in the link below -

类别

Help CenterFile Exchange 中查找有关 Assumptions 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by