MATLAB: Table shows [1×1 sym]

error using sym/roundtabletoo many input argumentsvpasolve

Hello all,
I'm a beginner on MatLab, as you can see looking at my code. :/
I made a table results, but some columns show [1×1 sym] instead of the numeric value.
>> T
T =
10×8 table
x r_radius a a_prime beta beta_i psi c_radius
______ ________ _________ _________ _________ _________ _________ _________
1 0.13333 [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym]
1.7222 0.22963 [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym]
2.4444 0.32593 [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym]
3.1667 0.42222 [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym]
3.8889 0.51852 [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym]
4.6111 0.61481 [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym]
5.3333 0.71111 [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym]
6.0556 0.80741 [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym]
6.7778 0.9037 [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym]
7.5 1 [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym]
When I check in the Command Window the matrices that don't show up in the table, it does return the numeric values.
a =
0.31698729810778067661813841462353
0.3262837777440087165440265301808
0.32954671600852516464237599910151
0.3309989121113711334050402800197
0.33175810683123203783836260106585
0.33220147460088597174212384813428
0.33248184041064921067847020995443
0.33267000685409559982051967533792
0.33280224969353673811924615373881
0.33289865996267927658115250868875
Although, there is a bunch of decimals, I thought it may be the source of the problem.
So I tried to use the round function, with 3 decimals for instead, but it shows the error:
>> round(a,3)
Error using sym/round
Too many input arguments.
I had found those values with the vpasolve function, which seems to give me a result full of decimals, maybe that's the source of the problem (Also, as a beginner, my code is very clinky and I have difficulties to resolve this system of equation at once, but I made it work…).
Would you have an idea to solve this please ? 🙂
%a
syms a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
x=linspace(1,TSR,10)';
eqn1=(x(1)==(4*a1-1)*sqrt((1-a1)/(1-3*a1)));
eqn2=(x(2)==(4*a2-1)*sqrt((1-a2)/(1-3*a2)));
eqn3=(x(3)==(4*a3-1)*sqrt((1-a3)/(1-3*a3)));
eqn4=(x(4)==(4*a4-1)*sqrt((1-a4)/(1-3*a4)));
eqn5=(x(5)==(4*a5-1)*sqrt((1-a5)/(1-3*a5)));
eqn6=(x(6)==(4*a6-1)*sqrt((1-a6)/(1-3*a6)));
eqn7=(x(7)==(4*a7-1)*sqrt((1-a7)/(1-3*a7)));
eqn8=(x(8)==(4*a8-1)*sqrt((1-a8)/(1-3*a8)));
eqn9=(x(9)==(4*a9-1)*sqrt((1-a9)/(1-3*a9)));
eqn10=(x(10)==(4*a10-1)*sqrt((1-a10)/(1-3*a10)));
a1=vpasolve(eqn1,a1,[1/4 1/3]); %Finding a between 1/4 and 1/3
a2=vpasolve(eqn2,a2,[1/4 1/3]);
a3=vpasolve(eqn3,a3,[1/4 1/3]);
a4=vpasolve(eqn4,a4,[1/4 1/3]);
a5=vpasolve(eqn5,a5,[1/4 1/3]);
a6=vpasolve(eqn6,a6,[1/4 1/3]);
a7=vpasolve(eqn7,a7,[1/4 1/3]);
a8=vpasolve(eqn8,a8,[1/4 1/3]);
a9=vpasolve(eqn9,a9,[1/4 1/3]);
a10=vpasolve(eqn10,a10,[1/4 1/3]);
a=[a1;a2;a3;a4;a5;a6;a7;a8;a9;a10];

Best Answer

  • You need to convert the symbolic values to double for all the cases:
    a1=double(vpasolve(eqn1,a1,[1/4 1/3]));