필터 지우기
필터 지우기

Error using Solve with symmatrix equation

조회 수: 3 (최근 30일)
Christoph Feldkircher
Christoph Feldkircher 2023년 2월 24일
댓글: Christoph Feldkircher 2023년 2월 24일
Hi I'm trying to find the general symbolic solution to the following matrix equation:
, with A, L, H and 0 being matrices of any size.
I tried the following code:
A = symmatrix('A', [3 3]);
H = symmatrix('H', [3 3]);
L = eye(3,3) - A;
sol = solve(A + 1/2*L^2 - 1/6*L^3 - H==zeros(3,3), A);
Incorrect number or types of inputs or outputs for function 'solve'.
It gives me the following error: Incorrect number or types of inputs or outputs for function 'solve'. Could somebody give me a hint what I need to change? Thank you for any help in advance!

채택된 답변

Askic V
Askic V 2023년 2월 24일
The function solve doesn'tsupport symmatrix. One way to solve matrix equeation is the follwoing:
A_r = [3 -6; 5 2];
B_r = [7 4; -5 8];
X_r = 2*B_r-3*A_r
X_r = 2×2
5 26 -25 10
% solve symbolically
A = sym('a', [2 2]);
B = sym('b', [2 2]);
X = sym('x', [2 2]);
sol = solve(3*A+X-2*B == zeros(2,2), X);
[sol.x1_1, sol.x1_2; sol.x2_1, sol.x2_2]
ans = 
Since you have matrices 3x3 with power to 3, you need to be prepared to wait a long time.
  댓글 수: 1
Christoph Feldkircher
Christoph Feldkircher 2023년 2월 24일
Hey Askic V, thank you for the quick reply. Your method or symmatrix2sym would solve the problem for specific matrices, in this case, 3x3. However, is there any method to solve this equation for any arbitrary matrices of any size? This is probably more a math question than a programming question, but I was just wondering if Matlab can solve the equation for A: with A, L and H being matrices of any size, 0 as the zero vector and I as the identity matrix, as a general symbolic equation. I appreciate any help you can provide.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by