How can I speed up vpasolve?
Show older comments
I have the following equation that has no analytical inverse
where
are constants. However, I would like to be able to find
for a given z.
are constants. However, I would like to be able to find I am able to do this with the following code,
syms z thetaz
a = 1;
b = 2;
theta0 = 0;
eqn = (a*sin(theta0)-b*sin(thetaz))./(a*cos(theta0)+b*cos(thetaz)) == z;
v = 0.12; % given value of z
S = vpasolve(eqn,z == v);
vv = S.thetaz %associated value of thetaz
but I have thousands of values of v so this takes a very long time.
I have tried using a matlabFunction to speed this up but I'm not sure how to input a z value to give a thetaz value back.
syms z thetaz
a = 1;
b = 2;
theta0 = 0;
z = (a*sin(theta0)-b*sin(thetaz))./(a*cos(theta0)+b*cos(thetaz));
f1 = matlabFunction(z);
check = f1(0.12)
The above code thinks I would like to find z from thetaz, is there a way to find thetaz from z using a matlabFunction?
Alternatively is there a way to speed up vpasolve?
Many thanks.
Accepted Answer
More Answers (0)
Categories
Find more on Numeric Solvers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


