Problem with function output Problem with function output

1 回表示 (過去 30 日間)
Pietro Fiondella
Pietro Fiondella 2022 年 7 月 16 日
回答済み: Torsten 2022 年 7 月 16 日
I have this function that gives me as result a vector that has NaN element while i expect numerical values what i did wrong?
the input should be with different dimension
x= vector
n=number
function WCoeff = Coeff(x,n)
M=[1 2 3 4 5 6 7 8 9 10 11 12];
y=linspace(x(1),x(end),n*(numel(x)-1)+1);
WCoeff=interp1(M,x,y);
end

採用された回答

Torsten
Torsten 2022 年 7 月 16 日
y must be a vector with element between min M and max M.
This doesn't seem to be true in your case since you generate y in between min x and max x, I guess.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by