Really interesting question.Does it have a solution?

1 view (last 30 days)
Sajad Eng on 5 Jan 2022
Answered: Image Analyst on 5 Jan 2022
Produce a row vector x of 5 between 2 and 3 in Matlab commands, in which, the elements can be spaced equally.
Steven Lord on 5 Jan 2022
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.

Walter Roberson on 5 Jan 2022
No, it does not have a solution in double precision. The theoretical values would be
2, 2+1/6, 2+2/6, 2+3/6, 2+4/6, 2+5/6, 3
However when you work in double precision, 1/6 cannot be exactly represented, and the difference between adjacent terms will not be exactly the same in all cases, violating the equal-space requirement.

Image Analyst on 5 Jan 2022
If you're looking for a MATLAB function, try linspace().

R2010b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by