write a script that gives equidistanced values in the interval 0.8 - 1.6 depending on the input that is the number of the equidistant values in matlab

You can use linspace to create n equidistant values in the interval [0.8, 1.6], where n is the input number.

Here's an example script:

main.m
% get input number
n = input('Enter the number of equidistant values: ');

% create equidistant values
values = linspace(0.8, 1.6, n);

% display values
disp(values);
167 chars
9 lines

This script prompts the user to enter the number of equidistant values they want, then creates those values using linspace, and displays them.

For example, if the user enters 4, the output would be:

main.m
>> Enter the number of equidistant values: 4
    0.8000    1.0667    1.3333    1.6000
86 chars
3 lines

Note that the values are evenly spaced between 0.8 and 1.6.

related categories

gistlibby LogSnag