Plot det(matrixA - (x * eye(3))) where x = 0:3

조회 수: 1 (최근 30일)
Andrew Gapinski
Andrew Gapinski 2017년 11월 26일
댓글: Andrew Gapinski 2017년 11월 26일
I am new to MatLab and have been searching for a way to do plot this graph but cannot seem to figure it out.
Equation: det(matrixA - (x * eye(3))) where x = 0:3 and Matrix A is a predefined matrix
Error: Error using * Inner matrix dimensions must agree.
t = 0:3 Error in y1 = det(A1 - (t * eye(3)))
This equation as it stands is giving me an error everytime I run it and i think i understand where its coming from but am unsure how else to go about writing the equation any other way. I also need to be able to plot this for 4 different matrix A's on the same plot. Any help would be really appreciated! Thanks.

채택된 답변

Walter Roberson
Walter Roberson 2017년 11월 26일
matrixA = rand(3); % do for some random matrix A
syms x
matdet = det(matrixA - (x * eye(3)));
fplot(matdet, [0 3])
  댓글 수: 2
Andrew Gapinski
Andrew Gapinski 2017년 11월 26일
Thanks for the quick response, I tried running this and am getting this error: Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body must be sym expression.
Andrew Gapinski
Andrew Gapinski 2017년 11월 26일
Nvm a simple clearvars worked. Thanks!

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

추가 답변 (1개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by