Ho do i convert this number to an integer?

1 visualización (últimos 30 días)
Bharatha Ravi
Bharatha Ravi el 24 de Mzo. de 2020
Comentada: Bharatha Ravi el 24 de Mzo. de 2020
I'm using this code to solve an equation.
syms b
w=1150;di=32.59;do=23.44;
sol=solve((w-(2.*90.*sind(b))).^2==(w-(90.*sind(b+di))-(90.*sind(b-do))).^2+((90.*cosd(b-do))-(90.*cosd(b+di))).^2,b);
vpa(sol)
I'm solving for b and im supposed to get around 28.1606 but im getting
ans =
144.93095960237559740993061817135 + 177.92191183196224178797359740301i
Why am i not gettin gthe answer? Do i have to onvert it?

Respuesta aceptada

Birdman
Birdman el 24 de Mzo. de 2020
Try vpasolve:
w=1150;di=32.59;do=23.44;
sol=vpasolve((w-(2.*90.*sind(b))).^2==(w-(90.*sind(b+di))-(90.*sind(b-do))).^2+((90.*cosd(b-do))-(90.*cosd(b+di))).^2,b)
vpasolve solves the equation numerically.
  11 comentarios
Birdman
Birdman el 24 de Mzo. de 2020
Replace the line
sol=vpasolve((w-(2.*90.*sind(b))).^2==(w-(90.*sind(b+di(i)))-(90.*sind(b-do(i)))).^2+((90.*cosd(b-do(i)))-(90.*cosd(b+di(i)))).^2,b);
with
sol(i)=vpasolve((w-(2.*90.*sind(b))).^2==(w-(90.*sind(b+di(i)))-(90.*sind(b-do(i)))).^2+((90.*cosd(b-do(i)))-(90.*cosd(b+di(i)))).^2,b);
Bharatha Ravi
Bharatha Ravi el 24 de Mzo. de 2020
Awesome!! Thank you tons again!

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by