subs command does not create symbolic variable?

조회 수: 1 (최근 30일)
nafis irtija
nafis irtija 2015년 6월 19일
댓글: John D'Errico 2015년 6월 19일
I am using MATLAB R2011a. I have symbolic math toolbox installed. When I use the "subs" command to replace a value in a symbolic variable, instead of symbolic variable a normal variable is created ... My code is
>> f=int(g,x)
f =
asin((2*x)/5 - 4/5)/2
>> subs (f,x,3)
ans =
0.2058
What am missing?
  댓글 수: 2
nafis irtija
nafis irtija 2015년 6월 19일
In the mathworks tutorial video they wrote
>>f3=subs(f,x,3)
and the variable f3 was symbolic.when i write the same code,f3 is not symbolic.and they used "eval(f3)" to get the value 0.2058.when I write
eval(f3)
it gives an error.
John D'Errico
John D'Errico 2015년 6월 19일
It is difficult to know, since your version is so old. It works fine for me. For eample, since I do not have g, I did this:
syms x
f = asin((2*x)/5 - 4/5)/2
f =
asin((2*x)/5 - 4/5)/2
subs(f,x,3)
ans =
asin(2/5)/2
with no problems. But I am using the current release.

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

답변 (1개)

Martin Brown
Martin Brown 2015년 6월 19일
You've evaluated
asin((2*3)/5 - 4/5)/2
which is indeed 0.2058. It's no longer symbolic?

카테고리

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