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

5 ビュー (過去 30 日間)
Erdem Aktürk
Erdem Aktürk 2022 年 12 月 16 日
編集済み: Askic V 2022 年 12 月 16 日
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 ?

回答 (1 件)

Askic V
Askic V 2022 年 12 月 16 日
編集済み: Askic V 2022 年 12 月 16 日
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.

カテゴリ

Help Center および File ExchangeSymbolic Variables, Expressions, Functions, and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by