Info
此问题已关闭。 请重新打开它进行编辑或回答。
how to fix invalid first data argument
1 次查看(过去 30 天)
显示 更早的评论
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)
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!