solve command help needed.
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Divya Patel
am 13 Mär. 2021
Kommentiert: Walter Roberson
am 13 Mär. 2021
here is my code,only 5 lines, and i m trying to solve for b,
syms b m theta
m = 5;
theta = 20;
eq = tand(theta)==(2*(1/tand(b)))*(((m*m*(sind(b)*sind(b))-1))/(m*m*(1.4+(cosd(b)*cosd(b)))+2)) ;
solve(eq,b)
the answer i get is this ==> -(log(root(z^6 - z^4*(1238888939898706904063102115185851/2095413426666905974699416890572625 + 2864291029470578218930659559211008i/2095413426666905974699416890572625) - z^2*(2168555873514773727160036100864837/2095413426666905974699416890572625 - 2244186785976947882873506458763264i/2095413426666905974699416890572625) + (78442739762537124403601334665223/83816537066676238987976675622905 + 29528773499696682669388242878464i/83816537066676238987976675622905), z, 1))*180i)/pi
now idk where z comes from since its not part of my code, but i also saw some imaginary parts so since i wanted a real number i tried this
syms b m theta
m = 5;
theta = 20;
eq = tand(theta)==(2*(1/tand(b)))*(((m*m*(sind(b)*sind(b))-1))/(m*m*(1.4+(cosd(b)*cosd(b)))+2)) ;
solve(eq,b,'real',true)
here i get the answer
ans = (180*(2*pi*k + atan2(x, 1) - atan2(-x, 1)))/pi
now its a smaller eq but idk what the k or x values to be,and where they come from
the ideal answer should be 29.8 for b.
so any one know whats happening and how to solve this.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 13 Mär. 2021
More solutions than you can shake a stick at.
syms b m theta
m = 5;
theta = 20;
eqn = tand(theta)==(2*(1/tand(b)))*(((m*m*(sind(b)*sind(b))-1))/(m*m*(1.4+(cosd(b)*cosd(b)))+2)) ;
sol = solve(eqn, b, 'returnconditions', true)
sol.b
sol.parameters
sol.conditions
k = 0;
z1 = solve(subs(sol.conditions, sol.parameters(1), k));
sol6_0 = simplify(subs(subs(sol.b, sol.parameters(1), k), sol.parameters(2), z1))
vpa(sol6_0)
k = 1;
z1 = solve(subs(sol.conditions, sol.parameters(1), k));
sol6_1 = simplify(subs(subs(sol.b, sol.parameters(1), k), sol.parameters(2), z1))
vpa(sol6_1)
k = -1;
z1 = solve(subs(sol.conditions, sol.parameters(1), k));
sol6_m1 = simplify(subs(subs(sol.b, sol.parameters(1), k), sol.parameters(2), z1))
vpa(sol6_m1)
2 Kommentare
Walter Roberson
am 13 Mär. 2021
You probably don't really care. What you probably want is more like
syms m theta
syms b
assume(b >= -90 & b <= 90)
m = 5;
theta = 20;
eq = tand(theta)==(2*(1/tand(b)))*(((m*m*(sind(b)*sind(b))-1))/(m*m*(1.4+(cosd(b)*cosd(b)))+2)) ;
vpasolve(eq, b)
all of the values in sol6_0, sol6_1, sol6_m1, and many others, are valid solutions for your equation, and you should be using them all -- unless you have physical reason to constrain the angles.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Assumptions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!







