Hi everyone,
I have a simple question, but yet I can't figure it out. I want to substitute (point + alfa * d) values over x values.
If you evaluate (point + alpha * d), result is [1 - alpha, 2 - alpha]. But when it comes to the substitution, it becomes [alpha - 1, alpha - 2]. Why is that? How can I make this correct? Thanks in advance.
variable_count = 2;
syms x [1 variable_count]
syms alpha
func = 3 * x1^2 + 2 * x1 * x2 + 2 * x2^2 + 7;
d = [-1 -1];
point = [1 2];
func_one = subs(func, x, point + alpha * d)

 채택된 답변

Paul
Paul 2021년 5월 8일

0 개 추천

It is correct, isn't it?
x1^2 = (-x1)^2, x1*x2 = (-x1)*(-x2), and x2^2 = (-x2)^2

댓글 수: 1

Onur YURDAKUL
Onur YURDAKUL 2021년 5월 9일
Yes, silly me. I was expecting just a raw substitution but instead it also rearranges the function. Thanks for your answer.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

질문:

2021년 5월 8일

댓글:

2021년 5월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by