I can not use i j k as a sym type what should I do

4 views (last 30 days)
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 ?

Answers (1)

Askic V
Askic V on 16 Dec 2022
Edited: Askic V on 16 Dec 2022
This is how I would solve this problem:
c1 = test()
v1 = 
c1 = 
c1 = 
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.

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!