solve equation for variable and how to get output as number not as substituted form
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi, I tried solving following code.solved for t and i want to substitutethat value back into equation. please help me
x1=rand(1); y1=rand(1); r = 10; v1= 2*rand(1); v2= 2*rand(1); sym t eq=(x1+t*v1)^2+(y1+t*v1)^2-r^2
solt=solve(eq,t); subsv=subs(eq,{t},{solt})
Thanks, Sita
댓글 수: 0
채택된 답변
A Jenkins
2015년 1월 27일
x1=rand(1);
y1=rand(1);
r = 10;
v1= 2*rand(1);
v2= 2*rand(1);
syms t
eq=(x1+t*v1)^2+(y1+t*v1)^2-r^2;
solt=solve(eq,t);
subsv=subs(eq,{t},{solt});
>> help vpa
vpa Variable precision arithmetic.
R = vpa(S) numerically evaluates each element of the double matrix
S using variable precision floating point arithmetic with D decimal
digit accuracy, where D is the current setting of DIGITS
>> vpa(subsv)
ans =
0
0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Numbers and Precision에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!