1
我有从一个MATLAB形式的字符串:MATLAB:转换字符串以自定义的符号函数来象征性的功能,并且评估它
string = 'funcTwo(funcOne(a,funcTwo(b,a)),funcThree(a))'
,我已经为符号函数定义如下功能:
syms a b l
funcOne(a,b) = a*b - a^b
funcTwo(a,b) = a*b - b^b
funcThree(a) = 5+a*7
我想通过执行规定的符号功能,以评估这个字符串,如:
result = funcTwo(funcOne(a,funcTwo(b,a)),funcThree(a))
result =
- (7*a + 5)*(a*(a^a - a*b) + a^(a*b - a^a)) - (7*a + 5)^(7*a + 5)
我怎样才能用这个字符串作为输入?我试过使用sym(),但它不工作我想要的:
result=sym(string)
result =
funcTwo(funcOne(a, funcTwo(b, a)), funcThree(a))
请帮忙。