필터 지우기
필터 지우기

represent a matrix with constants

조회 수: 6 (최근 30일)
NASADUDE
NASADUDE 2017년 9월 23일
답변: David Ding 2017년 9월 25일
Hi all can someone tell me how to represent these matrices in matlab I just want to represent them so I can find the inverse and other related matrices but I dont have an actual angle
  댓글 수: 1
John D'Errico
John D'Errico 2017년 9월 23일
편집: John D'Errico 2017년 9월 23일
What have you tried? If nothing, why not? Do you have the symbolic toolbox?
Lacking that, I'll point out they are rotation matrices. What useful property does the transpose of such a rotation matrix have? Do you really need to compute the inverse? (Hint: read that sentence about the transpose again.)

댓글을 달려면 로그인하십시오.

답변 (1개)

David Ding
David Ding 2017년 9월 25일
Hi,
If you really need to store these matrices in MATLAB without an angle in mind, you may wish to use functions where the input argument is the angle and the output is the matrix.
For example, say you need the matrix
[sin \theta, cos \theta; -cos \theta, sin \theta]
You can do something like this:
function matrixOut = genMatrix (angle)
matrixOut = [sin(angle), cos(angle); -cos(angle), sin(angle)];
end
If you wish to store the matrix in the base workspace where the angle is just a symbol or variable in your workflow, then you may use the Symbolic Math Toolbox to help you:
Example:
>> syms x
>> myMatrix = [sin(x), cos(x); -cos(x), sin(x)]
myMatrix =
[ sin(x), cos(x)]
[ -cos(x), sin(x)]
>> B = inv(myMatrix) % calculate the inverse of the matrix "myMatrix"
B =
[ sin(x)/(cos(x)^2 + sin(x)^2), -cos(x)/(cos(x)^2 + sin(x)^2)]
[ cos(x)/(cos(x)^2 + sin(x)^2), sin(x)/(cos(x)^2 + sin(x)^2)]

카테고리

Help CenterFile Exchange에서 Sparse Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by