필터 지우기
필터 지우기

finding maximum angle and managing data

조회 수: 1 (최근 30일)
jessica
jessica 2013년 7월 12일
h=130;
H=50;
i=1;
x=30:0.5:300;
AC=sqrt(x.^2+(h+H)^2);
AB=sqrt(x.^2+(h)^2);
th=acos((AB.^2+AC.^2-H^2)./(2*AB.*AC));
[thMax n]=max(th);
xthMax=x(n);
fprintf('Distance is %6.3ft at Maximum angle %6.3 deg\n',xthMax,thMax)
Hi , I have done this so far but now I get this
Distance is 153.000t at Maximum angle Distance is 153.000t at Maximum angle 0.162 deg how can I take away the repetition of the Distance and the angle is not 0.162 deg it should be 9.282 according to my calculations , do you see anything wrong thanks for the feedback >>

채택된 답변

Matt J
Matt J 2013년 7월 12일
편집: Matt J 2013년 7월 12일
Use acosd() if you want the result in degrees instead of radians.
I don't see the repetition you mention when I run your code, but make sure that xthMax and thMax are scalars.
  댓글 수: 2
Matt J
Matt J 2013년 7월 12일
And your fprintf call should probably look like this
fprintf('Distance is %6.3f at Maximum angle %6.3f deg\n',xthMax,thMax)
jessica
jessica 2013년 7월 12일
Thank you so much dear

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by