Function writing in MATLAB in symbolic format

2 次查看(过去 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?

回答(1 个)

Paul
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
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 CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by