How do I create a vector that increases in size with decreasing increments?

I'm trying to create a vector that increases between 0 and 10, increasing rapidly at first and then plateauing with smaller increments towards 10.
For example: [0 4 7 9 10]
I have tried using logspace and exp with:
y1 = logspace(0,1,5);
and
X = 0:0.5:10;
Y = exp(X/2);
plot(X,Y)
but they produce the opposite result I am trying to achieve. I've searched the web using key words but haven't came across anything similar, I think the "increasing whilst decreasing" factor is skewing results.
Are there any functions I'm missing that produce this vector automatically?
Thanks in advance!

Answers (1)

Hi,
this could meet your requirements:
a = 10;
x = 0:10;
y = a*exp(-1./x);
plot(x,y)
gives:
y =
0 3.6788 6.0653 7.1653 7.7880 8.1873 8.4648 8.6688 8.8250 8.9484 9.0484
.
If you need y to be integer use:
y = round(a*exp(-1./x));
Best regards
Stephan

Categories

Find more on Linear Algebra in Help Center and File Exchange

Asked:

on 13 Aug 2018

Edited:

on 13 Aug 2018

Community Treasure Hunt

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

Start Hunting!