Why do I get "Array indices must be positive integers or logical values" error when using "angle" function?

R
Rebekah · Nov 4, 2020 · 2.3K views
Question
Why do I get "Array indices must be positive integers or logical values" error when using "angle" function?     >> z = 22+i >> a = angle(z) >> z = 22.0000 + 1.0000i Array indices must be positive integers or logical values.
Expert Answer
Profile picture of John Williams
John Williams PhD Expert
Answered Aug 29, 2026

Based on the error message, it seems like you have a variable with the name "angle" stored in your workspace that overshadows the "angle" function

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!