When using linspace, matlab shows an error message= not enough input arguments.

14 ビュー (過去 30 日間)
Carey Huang
Carey Huang 2017 年 1 月 23 日
コメント済み: Star Strider 2017 年 1 月 23 日
for i=1:20
y=log(cond(vander(linspace(1,0,n))));
plot(n,y,'-');hold on
end
There is no line shown up.
Error message:
Not enough input arguments.
Error in linspace (line 19)
n = floor(double(n));
Help! Thanks in advance!

採用された回答

Star Strider
Star Strider 2017 年 1 月 23 日
編集済み: Star Strider 2017 年 1 月 23 日
I do not see where you defined ‘n’.
This works for me:
for n=1:20
y=log(cond(vander(linspace(1,0,n))));
plot(n,y,'pg');
hold on
end
EDIT
Also:
i = 1:20;
for n = i
y(n)=log(cond(vander(linspace(1,0,n))));
end
figure(1)
plot(i,y,'-pg');
grid
  2 件のコメント
Carey Huang
Carey Huang 2017 年 1 月 23 日
Thanks a lot!!
Star Strider
Star Strider 2017 年 1 月 23 日
My pleasure!

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 1 月 23 日
You would get that argument if you had defined n as being an input argument to your function, but the place that called your function did not pass in a value in the position that corresponds to n.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by