Ho do i convert this number to an integer?

1 view (last 30 days)
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?

Accepted Answer

Birdman
Birdman on 24 Mar 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 Comments
Birdman
Birdman on 24 Mar 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);

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!