Stuck with symbolic variables

조회 수: 3 (최근 30일)
Akbar
Akbar 2018년 7월 13일
답변: Birdman 2018년 7월 13일
How to correctly assign symbolic values to the selected elements of an Array?
syms a b c
x = [a;b];
c([1 2]) = x;
% it returns
c = [ a, b]
I Need
c = [a;b] % should be a column vector, not row vector like above.
c can be for example 11 dimentional column vector. I just want to assign values in x to the selected rows of c. For ex. lets say 3rd and 7th row of c must be equal to a and b respectively.
Something like this is needed, here is another ex.
c = [1;2;3;2;5;3];
c(1st and 4th) = [a;b];
c =
[a;2;3;b;5;3]

채택된 답변

Birdman
Birdman 2018년 7월 13일
You need to also convert your numerical array into symbolic so that things will be possible. For instance:
c=sym(c)
c([1 4])=x

추가 답변 (0개)

카테고리

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

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by