How to define a dependent variable for differentiaion?
27 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a variable A which is dependent on x, but I don't know the expression yet.
I have a differential equation dA/dx which is given as
dA_x = (T*b-E*Q*diff(C_s,x))/(E*S);
All the entities except C_s are constants. I can get A by integrating this equation.
A = int(dA_x,x);
But the problem lies with the differential expression of C_s which is given by
C_s = (M-2*A*E*Q)/(2*E*I);
Since A is not yet defined as a function or dependent variable of x, the differentiation results in 0.
How do I solve this?
I'm not looking for a numeriacal answer, I just need a symbolic expression.
0 个评论
采纳的回答
Ameer Hamza
2020-10-7
Define symbolic variable A like this
syms A(x)
It will tell MATLAB that a depends on x and will not become zero on differentiation.
6 个评论
Ameer Hamza
2020-10-7
Symbolic variables can be a bit confusing sometimes. For this case, the following code will work
syms L b h S I Q E u F M T c theta w k
syms x A(x) dA_x(x) C_s(x)
S = b*h;
I = b*h^3/3;
Q = b*h^2/2;
M = -((F*L^2)/2)+(F*(L*x-x^2/2));
C_s = (M-2*A*E*Q)/(2*E*I);
dA_x = (T*b-E*Q*diff(C_s,x))/(E*S);
A = int(dA_x,x);
C_s = subs(C_s);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!