range of values 5 to 85 in intervalks of 5 in matlab

To create a range of values from 5 to 85 in intervals of 5, you can use the linspace function in MATLAB. Here's an example code snippet that uses a for loop to print out the values generated by linspace:

main.m
% Define the start and end values of the range
start_val = 5;
end_val = 85;

% Use linspace to generate the values in the range
interval = 5;
range_vals = linspace(start_val, end_val, (end_val-start_val)/interval + 1);

% Print out the generated values using a for loop
for i = 1:length(range_vals)
    disp(range_vals(i));
end
328 chars
13 lines

This code first defines the start and end values of the range, and specifies the desired interval (in this case, 5). It then uses linspace to generate an evenly spaced array of values between the start and end values, with a total number of values equal to (end_val-start_val)/interval + 1.

Finally, the code uses a for loop to print out each of the generated values on a new line.

gistlibby LogSnag