필터 지우기
필터 지우기

imaginary solution with solve

조회 수: 5 (최근 30일)
monarch
monarch 2017년 12월 1일
편집: David Goodmanson 2017년 12월 7일
I am trying to solve for 2 variables R2 and theta. Since the systems are not linear, equationsToMatrix and linsolve don't work. So I tried solve.
At one point I was getting a symbolic solution with i in it (which I have since been unable to reproduce) and so I tried to initialize the variables as 'real':
E = 447000;
v = 849968100;
deltay = .00127;
q = 40;
t = .000211;
R = .0525;
R2 = sym('R2','real');
theta = sym('theta','real');
eqns = [deltay*(2*E*t)/(q*(1-v)) == (R2^2)*(1-cos(theta)), sin(theta) == R/R2];
vars = [R2 theta];
[solR2,soltheta] = solve(eqns, vars)
% R2 = double(R2)
% theta = double(theta)
And now, instead of getting an imaginary solution, I get an empty symbolic variable. In the end, I'd like to get a real numeric solution for R2 and theta.
TIA! :)

채택된 답변

Walter Roberson
Walter Roberson 2017년 12월 1일
There are no real-valued solutions for R2 and theta for those constants.
The system of equations is a quadratic. The two forms are
R2 = 2*(-(1/4)/(((1/4)*R^2*(-1+v)*q+deltay*E*t)*(-1+v)*q))^(1/2)*t*deltay*E
theta = arctan(R/((-(1/4)/(((1/4)*R^2*(-1+v)*q+deltay*E*t)*(-1+v)*q))^(1/2)*t*deltay*E), (-2*deltay*E*t-R^2*(-1+v)*q)/(E*t*deltay))
and
R2 = -2*(-(1/4)/(((1/4)*R^2*(-1+v)*q+deltay*E*t)*(-1+v)*q))^(1/2)*t*deltay*E
theta = arctan(-R/((-(1/4)/(((1/4)*R^2*(-1+v)*q+deltay*E*t)*(-1+v)*q))^(1/2)*t*deltay*E), (-2*deltay*E*t-R^2*(-1+v)*q)/(E*t*deltay))
If you examine the ^(1/2) portions, you will see that they involve -1 times an expression. When all of the constants are positive and v is greater than 1, then the expression is strictly positive, leading to a negative inside the sqrt, which will be imaginary.
At least one of your constants would need to change sign, or your v would need to be less than 1, in order to be taking the square root of a positive value there.
  댓글 수: 24
David Goodmanson
David Goodmanson 2017년 12월 3일
If R/R2 is positive (and less than one) then asin outputs into the first quadrant, so you get check_theta = 0.1513. But since sin(theta) = sin(pi-theta), (pi-theta) is also a valid solution for asin. Indeed if you compare check_theta with theta from the acos calculation, then if you check whether (pi - check_theta) = theta, that checks out.
Geometrically, is check_theta really the angle that counts? It's certainly in the range you wanted.
You did not yet mention what deltay is. Is it a deflection?
monarch
monarch 2017년 12월 3일
편집: Walter Roberson 2017년 12월 3일
Yes - deflection. "deltay is change in the height dimension y; y is length of cylindrical or conical shell and is also used as a vertical position coordinate, positive upward."
I agree that check_theta is the one that makes most sense to me geometrically. However, plugging it back in to the deltay equation gives me a different deltay than the fixed one I input from the beginning.
The is the plot I get for theta on x axis, deltay on y axis for the above set of conditions (where deltay is supposed to be .0048).

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

monarch
monarch 2017년 12월 3일
For the curious...the mystery has been solved. For this material, E varies under these conditions (but we can't measure it in this experiment) so I solved for E under various conditions and found that it's nowhere near the constant for E I was using (that was derived from a different experiment). When I use the derived E and feed everything back in, the thetas match. HOORAY!
  댓글 수: 3
monarch
monarch 2017년 12월 4일
Yes that is true the shell was pressurized on the inside...and I understand your concern with using the derived E. It does indeed problems. I was just happy to see the theta matching...but yes, it is problematic and most likely pointing to some serious assumption violating going on!
David Goodmanson
David Goodmanson 2017년 12월 4일
편집: David Goodmanson 2017년 12월 7일
Could you describe the experimental setup, for example is it a hemisphere, and how you are measuring y, and how is your angle theta measured or defined?
I'm not sure what you don't like about the plot that you posted since it looks like it peaks out at .0048 just like it should.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by