Why am I getting error:- Empty sym: 0-by-1
1 view (last 30 days)
Show older comments
KAJAL KUMARI
on 8 Jul 2021
Answered: Walter Roberson
on 9 Jul 2021
I am trying to get the values of variables using vpasolve.
syms n1 n2 n3 n4 n5 n6 n7 n8 n9 n10 n11 n12 n13 n14 n15 n16 n17 K
eqn1 = ((0.2)^3).*n1 + ((0.22)^3).*n2+((0.23)^3).*n3+ ((0.24)^3).*n4 + ((0.25)^3).*n5+((0.26)^3).*n6+((0.27)^3).*n7+((0.28)^3).*n8+((0.29)^3).*n9+((0.3)^3).*n10+((0.31)^3).*n11+((0.32)^3).*n12+((0.34)^3).*n13+((0.35)^3).*n14+((0.4)^3).*n15+((0.42)^3).*n16+((0.45)^3).*n17==K;
eqn2 = ((0.2)^3).*n1/K==1;
eqn3 = ((0.22)^3).*n2/K==1.5;
eqn4 = ((0.23)^3).*n3/K ==4;
eqn5 = ((0.24)^3).*n4/K ==7;
eqn6 = ((0.25)^3).*n5/K ==11.4;
eqn7 = ((0.26)^3).*n6/K ==13.8;
eqn8 = ((0.27)^3).*n7/K ==15;
eqn9 = ((0.28)^3).*n8/K ==12;
eqn10 = ((0.29)^3).*n9/K ==8;
eqn11 = ((0.3)^3).*n10/K == 4.5;
eqn12 = ((0.31)^3).*n11/K ==2.5;
eqn13 = ((0.32)^3).*n12/K ==1.4;
eqn14 = ((0.34)^3).*n13/K ==1;
eqn15 = ((0.35)^3).*n14/K ==0.5;
eqn16 = ((0.4)^3).*n15/K ==0.2;
eqn17 = ((0.42)^3).*n16/K ==0.1;
eqn18 = ((0.45)^3).*n17/K==0.02;
eqn19 = n1+n2+n3+n4+n5+n6+n7+n8+n9+n10+n11+n12+n13+n14+n15+n16+n17 == 7.68e8;
eqns = [eqn1,eqn2,eqn3,eqn4,eqn5,eqn6,eqn7,eqn8,eqn9,eqn10,eqn11,eqn12,eqn13,eqn14,eqn15,eqn16,eqn17,eqn18,eqn19];
vars = [n1 n2 n3 n4 n5 n6 n7 n8 n9 n10 n11 n12 n13 n14 n15 n16 n17 K];
answer = solve(eqns,vars);
vpa(answer.n1)
vpa(answer.n2)
vpa(answer.n3)
vpa(answer.n4)
vpa(answer.n5)
vpa(answer.n6)
vpa(answer.n7)
vpa(answer.n8)
vpa(answer.n9)
vpa(answer.n10)
vpa(answer.n11)
vpa(answer.n12)
vpa(answer.n13)
vpa(answer.n14)
vpa(answer.n15)
vpa(answer.n16)
vpa(answer.n17)
1 Comment
Sharmin Kibria
on 9 Jul 2021
I believe the system of equations do not have a solution. Check the second tip in the following.
Accepted Answer
Walter Roberson
on 9 Jul 2021
There is no solution.
You have 19 equations in 18 variables.
If you solve the middle 17 equations using solve() you get solutions for the n* variables in terms of K.
When you substitute those into the first equation, you get an expression in K on the left and an expression in K on the right. The only solution for that is K = 0. Substituting K = 0 into the solutions to the middle 17 shows they must all be 0 as well.
But making the variables all 0 does not satisfy the final equation. So, no solution.
0 Comments
More Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations 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!