calculate the matrix when there are x and y as variables

3 ビュー (過去 30 日間)
Yossi Mendel
Yossi Mendel 2025 年 4 月 29 日
コメント済み: Torsten 2025 年 4 月 29 日
Assuming i have a matrix that looks like that :
A=[3*x^2+5*y+7 6*x+y^3 ; x^3-7*y 1/y+4*x-5]
If x=3 and y=1
how can i calculate the value of matrix A ?
I have a license to symbolic
Appreciate support
thanks in advance
Yossi

採用された回答

Voss
Voss 2025 年 4 月 29 日
You have it already:
x=3;
y=1;
A=[3*x^2+5*y+7 6*x+y^3 ; x^3-7*y 1/y+4*x-5]
A = 2×2
39 19 20 8
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Or, if you want to use the Symbolic Math Toolbox:
syms x y
A=[3*x^2+5*y+7 6*x+y^3 ; x^3-7*y 1/y+4*x-5]
A = 
result = subs(A,[x,y],[3,1])
result = 
  1 件のコメント
Torsten
Torsten 2025 年 4 月 29 日
Or define A as a function:
A = @(x,y)[3*x^2+5*y+7 6*x+y^3 ; x^3-7*y 1/y+4*x-5];
A(3,1)
ans = 2×2
39 19 20 8
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by