Why does the code have Check for incorrect argument data type or missing argument in call to function 'zero'?

1 ビュー (過去 30 日間)
h=0.1;
x=0:h:1;
y=zero(size(x));
y(1)=0;
n=numel(y);
y1=exp(x)-x-1;
for i=1:n-1
f = x(i)+y(i);
y(i+1) = y(i) + h * f;
fprintf('%f\t %f\t %f\t %f\n',x,y(i+1),y1,y1-y(i+1));
end

回答 (1 件)

Stephen23
Stephen23 2022 年 9 月 16 日
編集済み: Stephen23 2022 年 9 月 16 日
Change the function from ZERO to ZEROS.
ZEROS creates an array of the value 0: https://www.mathworks.com/help/matlab/ref/zeros.html
ZERO does not.

カテゴリ

Find more on General Applications in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by