![]() ![]() ![]() ![]() If you want finer details for your graph, use linspace as suggested by x = linspace(-3, 6, 100) % produces a vector with 100 points between -3 and 6. is written in front of the operator.Īdditionally, we can improve the code substantially by using the colon operator to generate x: x = -3:6 % produces the same as ^ to calculate the values vectorized for every element. Note that we need to use element-wise operators like. So in your code, there is no need for a loop at all. Other languages like C and Python start at 0. This is because Matlab's indexing starts at 1. Hello everyone, I am new to MATLAB programming and I want to use a for loop starting with an index 5 and reducing to 1. Edited: Dennis M on Accepted Answer: Azzi Abdelmalek. Subscript indices must either be real positive integers or logicals. Follow 1 231 views (last 30 days) Show older comments. ![]()
0 Comments
Leave a Reply. |