Extracting numeric values from symbolic variables
이전 댓글 표시
I have two matrices say
x=[2 4 9 10];
syms c [1 4];
x==c
it returns
2=c1
4=c2
9=c3
10=c4
However when I write c1 in command window, it returns symbolic 'c1'.
I wanted to extract these numeric values or assign these values to c vector. How one would go around this.
채택된 답변
추가 답변 (3개)
madhan ravi
2020년 9월 6일
1 개 추천
== forms an equation , it DOESN’T assign any values.
댓글 수: 1
madhan ravi
2020년 9월 6일
편집: madhan ravi
2020년 9월 6일
I would suggest you to do the below instead:
c = num2cell(x);
celldisp(c)
Alphonce Owayo
2021년 2월 23일
1 개 추천
For example;
syms x y
eqn1=x+y==20;
eqn2=2.3x-9y==13;
soln=vpasolve(eqn1,eqn2);
xsoln=soln.x;
ysoln=soln.y;
or
xsoln=double(soln.x);
ysoln=double(son.y);
disp(xsoln);
disp(ysoln);
Alphonce Owayo
2021년 2월 23일
0 개 추천
shown above is how to extract numeric values from symbolic variables and display them in the command window.
카테고리
도움말 센터 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!