필터 지우기
필터 지우기

Differentiation with respect to variable which has been changed to numeric type

조회 수: 2 (최근 30일)
Hello, consider the given expression. Here x and y are symbolic variables and X and Y are numeric matrices of same size. All other variables are scalars.
RVector = ( (x - X).^2 + (y - Y).^2 + (alpha_C * d_C).^2 ) .^q;
When I execute the the following lines
x = X;
y = Y;
R_0Vector = double((subs(RVector)));
x and y becomes numeric variables. (Right?) Now, after the execution of above lines, how can I differentiate RVector with respect to x and y?

채택된 답변

Walter Roberson
Walter Roberson 2017년 11월 7일
The easiest way is to avoid the problems associated with assigning a new value to a symbolic variable that has been used in other expressions. Do not do the assignments x = X and y = Y. Instead do
R_0Vector = double(subs(Rvector, {x, y}, {X, Y}));
and then x and y will still be symbolic, allowing you to continue on with
diff(Rvector, x)

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by