sin() - Subscript indices must either be real positive integers or logicals.
1 view (last 30 days)
Show older comments
Sherelin Fridkin
on 19 Oct 2020
Edited: James Tursa
on 20 Oct 2020
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 Comments
James Tursa
on 19 Oct 2020
Edited: James Tursa
on 20 Oct 2020
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( ).
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Simulink Environment Customization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!