sin() - Subscript indices must either be real positive integers or logicals.

조회 수: 1 (최근 30일)
worked fine before, trying to debug - got the error only for the sin() parts
(sin(7 * pi / 8)^2)
((sin (7 * pi / 8)) ^ 2)
%2.calculate a)
disp('2. a)');
ans_2a = (cos (5 * pi / 6))^2 * (sin(7 * pi / 8)^2) + (((tan (pi / 6 * log(8)))));
disp(ans_2a);
%ans2 = 2.6285
%2.calculate b)
disp('2. b)');
ans2_b = (cos((5 * pi / 6) ^ 2)) * ((sin (7 * pi / 8)) ^ 2) + ((tan (pi * log(8) / 6) / (7 * (5 / 2))));
disp(ans2_b);
%ans2_b = 0.2325
  댓글 수: 2
James Tursa
James Tursa 2020년 10월 19일
편집: James Tursa 2020년 10월 20일
Look in your code where you are creating a variable named "sin" and rename it to something else so it doesn't shadow the MATLAB function sin( ).

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

채택된 답변

madhan ravi
madhan ravi 2020년 10월 19일
clear sin % since it's a variable

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by