Function writing in MATLAB in symbolic format
1 回表示 (過去 30 日間)
古いコメントを表示
I have been trying wrting this equation (screenshot1) in MATLAB in symbolic format. Mathematically, my equation is correct. But it is always giving me error (screeenshot2). As you are seeing the the small piece of code written in screenshot2, can you please help me to write that equation symbolically?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1333200/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1333205/image.png)
0 件のコメント
回答 (1 件)
Paul
2023 年 3 月 22 日
It appears that the symfun objects have to have the same arguments (number and order) to add them
syms rho(x,y,z,t) rho_m(x,y,z,t) rho_p(x,y,z,t)
eq1 = rho(x,y,z,t) == rho_m + rho_p;
disp(eq1)
1 件のコメント
Walter Roberson
2023 年 3 月 22 日
Right. The alternative is to invoke the symbolic functions on specific variables (turning them into expressions), add the expressions, and create a symbolic function from the result.
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!