End-of-array value entry
이전 댓글 표시
I have the following code which achieves what I need. However, when I tried to make it a bit more sophisticated and perform the substitution I note in the for statement below, I get no results. Cold someone please venture a guess as to why this is the case?
Io=2; K=1.38*(10^(-23)); q=1.602*(10^(-19)); id=-1:0.1:0.6;
for i=1:17 -----> substitute with for i=1:id(end)
T=75;
Vd(i)=((id(i)./Io)+1).*(exp(K*T)/q);
end
채택된 답변
추가 답변 (1개)
Hikaru
2014년 8월 11일
Instead of substituting with
i=1:id(end)
Use:
i=1:length(id)
You also might want to preallocate Vd since it changes size in every iteration.
댓글 수: 2
Maroulator
2014년 8월 11일
Star Strider
2014년 8월 11일
@Maroulator — You can give him a vote (2 points).
카테고리
도움말 센터 및 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!