For loop - what about my min and max values?
2 views (last 30 days)
Show older comments
For loop - what about my min and max values? I'm using a for loop and although my plot is right, I'm only seeing my maximum x-axis value in the Workspace Max column. Is there a way to have the Min and Max columns actually correct?
David Young on 11 Dec 2011
i is already defined in Matlab - as long as you haven't redefined it earlier in the program you don't need to do i = sqrt(-1)
bym on 11 Dec 2011
Your x axis is the loop variable f, which can only take on one value at a time, thus the min and max are the same. To do what you want, you would have to modify your code something like this
freq = 50:1000;
AbsCoefrec = zeros(size(freq)); % preallocate!
for f = freq
% ---insert code here---
More Answers (0)
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!