Getting Empty sym: 0-by-1 when using solve function

I am trying to find the value of x when the equation is equal to zero. I keep getting an empty sym 0-by-1. Any suggestions? Thanks!
I = (pi*.015^4)/64;
E = 200*10^9;
syms x
[x] = solve(0 == (1/(E*I))*((-199.46/2)*x^2 + (290/2)*(x-.25)^2 - (90.66/2)*(x-.8)^2 + 11.22),x)
x = double(x)

3 Kommentare

solve requests that an infinitely precise solution be found if possible . It makes little sense to use solve with floating point numbers as floating point numbers represent a semirandom point within an interval . It is a category error to use the two together . You should only use solve with infinitely precise inputs
For example is the 11.22 standing in for 101/9 ?
The 11.22 is a constant of integration that I calculated by hand. All I need to do is find the value of x at which the equation is zero. I have used the solve function before but not for something like this. Is there another function that will solve for x?
vpasolve potentially

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Star Strider
Star Strider am 23 Nov. 2018
Bearbeitet: Star Strider am 23 Nov. 2018
Your code works for me:
I = (pi*.015^4)/64;
E = 200*10^9;
syms x
[x] = solve(0 == (1/(E*I))*((-199.46/2)*x^2 + (290/2)*(x-.25)^2 - (90.66/2)*(x-.8)^2 + 11.22),x)
x = double(x)
producing:
x =
7/30 - (2^(1/2)*261763^(1/2)*1i)/60
(2^(1/2)*261763^(1/2)*1i)/60 + 7/30
x =
0.233333333333333 - 12.0591827620651i
0.233333333333333 + 12.0591827620651i

4 Kommentare

I get that too when I run the code after first opening MATLAB. I needed x to be a real number so I did...
I = (pi*.015^4)/64;
E = 200*10^9;
syms x real
[x] = solve(0 == (1/(E*I))*((-199.46/2)*x^2 + (290/2)*(x-.25)^2 - (90.66/2)*(x-.8)^2 + 11.22),x)
x = double(x)
And got results of...
x =
Empty sym: 0-by-1
x =
0×1 empty double column vector
when I changed it back to the original code ..... (without the real)
I = (pi*.015^4)/64;
E = 200*10^9;
syms x
[x] = solve(0 == (1/(E*I))*((-199.46/2)*x^2 + (290/2)*(x-.25)^2 - (90.66/2)*(x-.8)^2 + 11.22),x)
x = double(x)
I got the same results
x =
Empty sym: 0-by-1
x =
0×1 empty double column vector
I'm not sure why it will not go back to the original results when I first ran the program.
you appear to have a quadratic . Expand it out and group terms and use the quadratic formula . II would be surprised if matlab is not calculating it correctly .
In other words either your equation is wrong or your expectations of aa real solution are wrong .
Your function has no real roots. If you plot it, this quickly becomes evident:
syms x real
I = sym((pi*.015^4)/64);
E = sym(200E9);
Eqn = (1/(E*I))*((-199.46/2)*x^2 + (290/2)*(x-.25)^2 - (90.66/2)*(x-.8)^2 + 11.22);
figure
fplot(Eqn, [-10 10])
ylim([-0.03 0.001])
grid
You can expand the fplot limits as far as you like. It does not change the result.
I got the empty result with real, and without it (using vpasolve):
x =
7/30 - (523526^(1/2)*1i)/60
(523526^(1/2)*1i)/60 + 7/30
x =
0.23333333333333333333333333333333 - 12.059182762065134606377924566193i
0.23333333333333333333333333333333 + 12.059182762065134606377924566193i
I am using R2018b.
Your equation has an expression in x in the numerator, and has E*I in the denominator. For any E*I that is non-zero and independent of x, then the roots of the equation are the same as the roots of the numerator. Therefore the values of E and I do not matter for the purpose of finding roots.
Your equation simplifies to
-600*x^2+280*x-87287 / (10000*E*I)
"a" and "c" are both negative, so b^2-4*a*c is subtracting a positive value from b^2, and -4*a*c is larger than b^2, so you would be taking sqrt() of a negative number. It isn't borderline either: it is solidly negative, around -209410400
Therefore no real roots.

Melden Sie sich an, um zu kommentieren.

Tags

Gefragt:

am 23 Nov. 2018

Kommentiert:

am 24 Nov. 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by