How to create a vector based on another vector in a for loop?
이전 댓글 표시
I would like to create a vector based on another vector, how do i do that? Is it easiest to do so with a for loop? Below is the code that i have so far. But it doesn't seem to be working. What am I missing?
for Vp=[0:0.2:4];
u=Vp/A
end
답변 (1개)
David Hill
2022년 4월 12일
Vp=0:.2:4;
A=5;
u=Vp/A;
댓글 수: 1
David Hill
2022년 4월 12일
Vp=0:.2:4;
A=5;
for k=1:length(Vp)
u(k)=Vp(k)/A;
end
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!