Info

この質問は閉じられています。 編集または回答するには再度開いてください。

how to fix invalid first data argument

1 回表示 (過去 30 日間)
santhosh s
santhosh s 2019 年 8 月 17 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
n=1;
for ii=1:0.5:9
t(n)=ii;
if ii>=0
y(n)=-3*ii.^2+5;
n=n+1;
elseif ii<0
y(n)=3*ii.^2+5;
n=n+1;
end
end
plot(t,y)

回答 (1 件)

Star Strider
Star Strider 2019 年 8 月 17 日
Your code runs without error for me.
Note that in your code ‘ii’ is never going to be less than 0, so the entire if block is not necessary.

Community Treasure Hunt

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

Start Hunting!

Translated by