Using vpasolve to store an array of solutions
13 views (last 30 days)
Show older comments
I am trying to use an array as an input to plot multiple outputs that I also wish to recieve as arrays but I recieve this error
Error using mupadengine/feval (line 195)
More equations than variables is only supported for polynomial systems.
Here is the code I am trying to work with:
x=[0 360];
L2=.1;
L4=4.76;
L5=4.55;
theta2=99+x;
w2=10;
anga2=0;
syms theta4 theta5 la lc
eqn1=L2*cosd(theta2)-la*cosd(theta4)+1.69*cosd(15.5)==0;
eqn2=L2*sind(theta2)-la*sind(theta4)+1.69*sind(15.5)==0;
eqn3=L4*cosd(theta4)-L5*cosd(theta5)+lc==0;
eqn4=L4*sind(theta4)-L5*sind(theta5)-(2.86+1.69*sind(15.5))==0;
s=vpasolve([eqn1,eqn2,eqn3,eqn4],[theta4,theta5,la,lc]);
theta4=s.theta4;
theta5=s.theta5;
la=s.la;
lc=s.lc;
0 Comments
Answers (1)
Star Strider
on 12 Jul 2020
Use solve instead of vpasolve, then use vpa on each of the results:
s=solve([eqn1,eqn2,eqn3,eqn4],[theta4,theta5,la,lc]);
stheta4 = vpa(s.theta4)
stheta5 = vpa(s.theta5)
sla = vpa(s.la)
slc = vpa(s.lc)
That will give you all of them.
.
2 Comments
Star Strider
on 12 Jul 2020
In R2020a Update 4, I get:
stheta4 =
18.842279938785301447678208983575
18.842279938785301447678208983575
-161.15772006121469855232179101643
-161.15772006121469855232179101643
stheta5 =
202.95208491158838934139316548765
-22.952084911588389341393165487651
- 90.0 + 20.657411926547563159279445881198i
270.0 - 20.657411926547563159279445881198i
sla =
1.7042190839952333693659000806486
1.7042190839952333693659000806486
-1.7042190839952333693659000806486
-1.7042190839952333693659000806486
slc =
-8.6946996593823179724949552072172
-0.31513491474309412760224942753366
4.5049172870627060500486023173754 + 1.6762282484967889104396885149306i
4.5049172870627060500486023173754 - 1.6762282484967889104396885149306i.
.
See Also
Categories
Find more on Loops and Conditional Statements 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!