hi, i created a vector form like given below and i want to replace x y z with t variable like this. P = [t^2 +2*t +3*t; t*t -2*t^2] . but this is a case where x = y = z =t. how can i replace x y and z with t .
syms x y z
P = [x^2 +2*y +3*z; x*y -2*z^2]

 채택된 답변

Star Strider
Star Strider 2022년 12월 3일

1 개 추천

Try something like this —
syms t x y z
P{1} = x^2 +2*y +3*z;
P{2} = x*y -2*z^2;
P = subs(P,{x,y,z},{t,t,t})
P = 
See the documentation on subs for details.
Another option is to create it as a symfun, then choose the arguments to assign to ‘t’.
.

댓글 수: 2

abdulsamed kaymakci
abdulsamed kaymakci 2022년 12월 5일
thanks sir.
As always, my pleasure!
Also, to get them as a column vector —
syms t x y z
P{1,:} = x^2 +2*y +3*z;
P{2,:} = x*y -2*z^2;
P = subs(P,{x,y,z},{t,t,t})
P = 
.

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

추가 답변 (1개)

VBBV
VBBV 2022년 12월 3일

1 개 추천

syms x y z
P = [x^2 +2*y +3*z; x*y -2*z^2]
subs(P,{x,y,z},{t,t,t})

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

릴리스

R2022b

질문:

2022년 12월 3일

댓글:

2022년 12월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by