I can not use i j k as a sym type what should I do
5 次查看(过去 30 天)
显示 更早的评论
Error using syms (line 284)
Unable to create a symbolic variable 'i' by using 'syms' inside a MATLAB function because 'i' is an existing function name, class name, method name, and
so on. Use 'sym' instead.
I keep getting this error when I am trying to get this (x^2)*i+(y*j) equation from App designer.Firstly I get this equation as a string type and convert it to the sym to do sum mathematical calculations.
It works outside of the Appdesigner but when I try to write this to the appdesigner edit text, I got this error
How can I solve this ?
0 个评论
回答(1 个)
Askic V
2022-12-16
编辑:Askic V
2022-12-16
This is how I would solve this problem:
c1 = test()
function c1 = test()
syms x y z k real
i = sym('i');
j = sym('j');
v1 = sym(dot([x^2 y z],[i j k]));
c1 = subs(v1,{x y z},{2 -3 2});
end
As you can see, i and j can be defined as symbolic variables inside the function. You just neen to use sym function.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Variables, Expressions, Functions, and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
