how can i write a code with consecutive number between 0-100 and use this values inside my code?
Show older comments
x = 0.05 + (0.1-0.05).*rand(10,1);
i made this code to use number x with different values but i dont want them to be random numbers. how can i write a code with consecutive number between 0-100 and use this values inside my code?
Accepted Answer
More Answers (1)
x=0:100 % creates 101 elements from 0 to 100
y=x(12) % sets y to the value of x(12)
x = 0.05 + (0.1-0.05).*[0:100]; % do some math to the 101 values before assigning to x
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!