I put down a script like this(adsbygoogle = window.adsbygoogle || []).push({});

for u=(10:10:20)'

i=(1:size(u,1))'

X=zeros(size(u,1),1)

X(i,1)=100/u(i,1)

end

I expect to get a result like

X=

10

5

but it came out like

X=

0

5

It seems it does work if it contain / in the equation. Please help!!

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab, for loop simple division problem

**Physics Forums | Science Articles, Homework Help, Discussion**