Find a variable as function of other variable with equations system using Symbolic ToolBox
Show older comments
I have 3 equations that connects between 4 variables, let's say:
syms a b c d;
r=b+d;
e=pi/2;
eq1 = c - a*sin(d) + b*cos(d) == 0;
eq2 = r - c*tan(e) - a*cos(d) - b*sin(d) == 0;
eq3 = b == e*r + a*tan(e);
Now I would like to find c(d), means, I would like to find what is c as a function of other variable, in this case - d.
Then perform other operations on c(d) such as differntiate etc.
What would be the best/easiest way to do that using Symbolic Toolbox?
Thanks.
2 Comments
Walter Roberson
on 4 Apr 2020
10 radians is an unusual angle, but that is probably not so important for your question.
Evyatar Sivan
on 4 Apr 2020
Accepted Answer
More Answers (1)
Ameer Hamza
on 4 Apr 2020
try this example
syms a b c d;
r=b+d;
e=pi/2;
eq1 = c - a*sin(d) + b*cos(d) == 0;
eq2 = r - c*tan(e) - a*cos(d) - b*sin(d) == 0;
eq3 = b == e*r + a*tan(e);
sol = solve([eq1 eq2 eq3], [a b c]);
C = sol.c; % c as function of d
% Now find its derivative
dC_dd = diff(C,d); % dc/dd
% you can also integrate it
IC = int(C,d);
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!