How do I stop getting extra zeros from a for loop?

Y=1.4
P3=113.15
vs_3=1.6884
c34= P3*(vs_3)^Y;
p34=zeros(size(1.69:+0.1:1.99));
for ve34= 1.69:+0.1:1.99
i=i+1;
p34(i)= c34./((ve34.^Y));
end
When running the for loop the p34 term retruns a 1x18 martix with mostly zeros with the intended restuls at the end. It should result in a 1x4 matrix with no zeros, but I keep getting these exra zeros. Does anyone know a way to fix this?
For some reason a different error "array indicies must be positive integers or logical values " occurs when run on 2022a compared to 2019a (what I have installed), which does not show that error when run on 2019a.

类别

帮助中心File Exchange 中查找有关 Loops and Conditional Statements 的更多信息

产品

版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by