フィルターのクリア

How do I fill lines between 2 values with interpolation

16 ビュー (過去 30 日間)
Gab D
Gab D 2019 年 3 月 19 日
コメント済み: Gab D 2019 年 3 月 19 日
Hi all,
I want to interpolate between 2 points and fill an array with the results, without knowing the step between each value. For example, If I have the vector
x=[1;zeros(17,1);10];
and would like to fill all the zeros by a linear regular step.
In Excel, it's like when you select space between 2 points and do Fille-> Series. Excel calculate the step and fill the empty spaces. I would like to do the same with multiple situation like this, this is why I want to use Matlab.
I tried the function interp1, but I'm not able to make it run since it asks for vectors I don't have...
I'm sorry that I can't provide codes... but I don't have anything that come close to a good results..
Thank you in adance!

採用された回答

Guillaume
Guillaume 2019 年 3 月 19 日
Probably, the easiest:
startvalue = 1;
endvalue = 10;
numberofpoints = 19; %includes start and end point
x = linspace(startvalue, endvalue, numberofpoints)
  1 件のコメント
Gab D
Gab D 2019 年 3 月 19 日
OMG
Thank you Guillaume! I didn't know about this function! Thanks a lot it works perfectly.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by