Bode Plot Index Exceeds Array Elements Error
Show older comments
Error using DynamicSystem/bode
Index exceeds the number of array elements. Index
must not exceed 7.
Error in bf_controller_tuning (line 496)
bode(ax(1), P / Gf_ana, 'k', omega_bode, opt), title('Plant P')
Hi All - I am on a mac, and am getting this error when running a script. The interesting thing is that a PC user runs the same and gets no error. Now that could be for some other buried reason like he has the right add-ons but we checked and I do also. I'm running a trial and have 5 days left to get this script running...!
5 Comments
Stephen
on 20 Mar 2024
Paul
on 20 Mar 2024
This line:
bode(ax(1), P / Gf_ana, 'k', omega_bode, opt)
is not valid based on the doc page bode or bode. Using ax(1) as the first argument seems to work (though not documented AFAICT), but I don't see anything about an opt argument, which causes an error, though not the same error reported above.
It would be helpful to have all of information needed to recreate the error messsage.
Michael Ernst
on 20 Mar 2024
The full script file can be found in my repo here: https://github.com/pichim/bf_controller_tuning
The script uses a custom function libary that can be found here: https://github.com/pichim/bf_function_libary
bf_controller_tuning.m was rigorously tested on Matlab R2023a on different windows machines. so it might have something to do with
- Mac
- Newer or older Matlab versions
- Matlab trial version
I suspect Mac, but i have no Mac available to test and debug the issue. so if anyone could test this, it would be greatly apprechiated!
Paul
on 21 Mar 2024
For this line of code (assuming it's the line causing a problem)
bode(ax(1), P / Gf_ana, 'k', omega_bode, opt), title('Plant P')
Please save P, Gf_ana, omega_bode, and opt in a .mat file and upload the .mat file using the Paperclip icon on the Insert menu.
Answers (0)
Categories
Find more on Plot 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!