calculate the matrix when there are x and y as variables

3 visualizaciones (últimos 30 días)
Yossi Mendel
Yossi Mendel el 29 de Abr. de 2025
Comentada: Torsten el 29 de Abr. de 2025
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

Respuesta aceptada

Voss
Voss el 29 de Abr. de 2025
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 comentario
Torsten
Torsten el 29 de Abr. de 2025
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>

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos


Versión

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by