Replacing function variables with a vector before taking a gradient
3 views (last 30 days)
Show older comments
Valeri Aronov
on 30 Jul 2021
Answered: Walter Roberson
on 31 Jul 2021
I have a symbolic function:
A = 1/((C1*C2*R1*R2*w^2 - 1)^2 + w^2*(C2*R1 + C2*R2)^2)^(1/2)
I would like to replace C1, C2, R1, R2 symbolic variables with an x vector where C1 = C1_0*x(1); C2 = C2_0*x(2); R1 = R1_0*x(3); R2 = R2_0*x(4); and take a gradient of A by x. Whatever I tried failed to produce the result I am seeking.
3 Comments
Accepted Answer
Walter Roberson
on 31 Jul 2021
syms x1 x2 x3 x4 real
syms C1_0 C2_0
x=[x1,x2,x3,x4]
A = subs(A, [C1, C2, R1, R2], [C1_0, C2_0, R1_0, R2_0] .*x)
gradient(A, x)
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!