solve an equation using solve() produces an array instead of a unique value
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
jojo
am 17 Nov. 2019
Kommentiert: Star Strider
am 18 Nov. 2019
d = 32*h + 200*(32*h - 8)*((4*h - 1)^2 - 1) - 16
I am trying to solve for h using "solve(d,h)" , however, I keep getting an array for of solutions!
[1/2
1/8 - (7*2^(1/2))/80
(7*2^(1/2))/80 + 1/8 ]
How could I obtain a unique value for h? The solution does not seem right. Is there a better function to be used ?
Thanks.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 17 Nov. 2019
The result is correct. There are three roots.
Plot it to see the result:
syms h
d = 32*h + 200*(32*h - 8)*((4*h - 1)^2 - 1) - 16;
ds = solve(d)
figure
fplot(d, [-0.1 0.6])
hold on
plot(ds, zeros(size(ds)), 'pg')
hold off
grid
6 Kommentare
Star Strider
am 18 Nov. 2019
I will need more details.
It depends on how you want to define ‘h’ and what you want to do.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!