How to create a matrix with variables?

조회 수: 10 (최근 30일)
BZ0892
BZ0892 2016년 1월 26일
댓글: Walter Roberson 2016년 1월 29일
Hello,
I am kind of new to Matlab so the questions I will ask probably sound a bit basic. Anyways, here goes:
I want to create the matrix below which has both constants and variables. How can I do this? I know how to create a normal matrix (e.g. B = [1 0 2; 3 4 5; 0 2 3] but I don't know how to create matrices with variables in them?
I tried to type the matrix in as is shown above but it doesn't seem to work. I'm pretty sure I should be following some sort of method but I have no clue.
I want to have the ability to assign different values to the variables at later stages as well.

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 1월 26일
v={0 1;'act*fr' 'y'}

Walter Roberson
Walter Roberson 2016년 1월 26일
It is not possible to plot a matrix that has unassigned variables in it. If you have the symbolic toolkit, it is possible to create such a matrix, but in order to plot you need to substitute particular numeric values.
The matrix looks to me to be a transformation matrix for 3D points. You do not plot transformation matrices themselves: you plot the results of transforming something.
  댓글 수: 4
BZ0892
BZ0892 2016년 1월 28일
편집: BZ0892 2016년 1월 28일
Apart from element a31, all the elements are constants that I've been given. Element a31 can vary since the ''Act'' term can vary. I understand that I can just enter the constants instead for the other elements, but for now I'd like to enter the elements so it looks like the image I posted.
Thanks!
EDIT: I'd like to add that in element a44, there should be no ''/'' sign. That is a mistake. It should be just 1-Fc*dt/Vc.
Walter Roberson
Walter Roberson 2016년 1월 29일
Assign values to dt Fr Fc Vc Vr
then
syms Act
A = [1 0 0 0; 0 1 0 0; Act*Fr*dt/Vr 0 ... and the rest of the terms]

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by