how can i solve this error?
Show older comments
Hi . i wanna write h(x) at a for loop. but i have error .

error is : '' Index in position 1 exceeds array bounds (must not exceed 1). "
x=1:0.1:6;
for i=1:0.1:6
h(i,:)=z2+(x(i,:)-ls)*z4;
end
Accepted Answer
More Answers (1)
x=1:0.1:6;
for i=1:length(x)
h(i)=z2+(x(i)-ls)*z4;
end
Categories
Find more on Loops and Conditional Statements 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!