Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

how to fix invalid first data argument

1 visualizzazione (ultimi 30 giorni)
santhosh s
santhosh s il 17 Ago 2019
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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)

Risposte (1)

Star Strider
Star Strider il 17 Ago 2019
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