How to solve Attempted to access (0) error.?
Show older comments
In attached figure, one equation is there which i need to implement.
where,
x[n] = a* r^n
a = 11; r = 0.9; L = 19; 0<=m<=L; 0<=n<=L
for this i have written a script.
clear all
a = 11;
r = 0.9;
L = 19;
for m = 0:L
for n = 0:L
S(m) = a*(r^n);
end
end
plot(S,m)
xlabel('Value of "S"');
ylabel('Value of "L"');
title('a = 11; r = 0.9; L = 19')
When i run it, it gives following error
Attempted to access (0); index must be a positive integer or logical.
Error in Question_6 (line 8)
S(m) = a*(r^n);
How to solve it..?
Accepted Answer
More Answers (1)
Jan
on 23 Nov 2014
0 votes
When you omit the clear all you can use the debugger to find out the reason of your problem.
Categories
Find more on Startup and Shutdown 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!