evalAt() does not work any way I use it

When I try using evalAt() function I always get an error. I have tried using it in many different ways.
Example 1:
y=x^2;
evalAt(y, x=3)
Error: File: plot_test.m Line: 2 Column: 12
The expression to the left of the equals sign is not a valid target for an assignment.
I also tried to use subs() and still get error.
I also tried reinstalling MATLAB and did not work.
I will really appretiate any help, Thanks

댓글 수: 3

Walter Roberson
Walter Roberson 2012년 10월 19일
Which MATLAB version are you using? That syntax has only been valid since R2012a.
Matt Fig
Matt Fig 2012년 10월 19일
편집: Matt Fig 2012년 10월 19일
But SUBS has been around for longer...
Yes, but the ability to use "=" in a symbolic expression (as opposed to assignment) is new in R2012a.
subs(y, x, 3)
not
subs(y, x=3)

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

 채택된 답변

Star Strider
Star Strider 2012년 10월 19일
편집: Star Strider 2012년 10월 19일

0 개 추천

Starting with 2012a, you can Create Symbolic Functions. This is probably the easiest way to do what you want:
syms x y
y(x) = x^2
z = y(3)
giving this result:
y(x) =
x^2
z =
9

추가 답변 (3개)

Matt Fig
Matt Fig 2012년 10월 19일
편집: Matt Fig 2012년 10월 19일

0 개 추천

What do you see when you type these? Do you see the help, or do you see function not found?
help evalAt
help subs
If you see 'function not found', then you don't have the symbolic toolbox installed, or you don't have a license checked out.
Sachin Ganjare
Sachin Ganjare 2012년 10월 19일
편집: Sachin Ganjare 2012년 10월 19일

0 개 추천

Most probably you do not have 'Symbolic Math Toolbox' installed on your system. Check using 'ver' command.
Diomedes
Diomedes 2012년 10월 19일

0 개 추천

Actually I have the 2012b edition and I have made sure that the Symbolic Math toolbox is install.
I found a solution to my problem. I just used the function eval() and it worked. Thanks a lot for you help.

카테고리

도움말 센터File Exchange에서 Thermodynamics & Statistical Physics에 대해 자세히 알아보기

질문:

2012년 10월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by