Getting error message, "Subscript indices must either be real positive integers or logicals."
조회 수: 2 (최근 30일)
이전 댓글 표시
I am trying to run this code.
R=100e6;
t=0:2:150;
h=2;
E=-60;
C=0.1e-9;
Iinj=repmat(10e-9,1,75);
Iinj(1,1)=0;
V= zeros(1,75);
V(1,1)=E;
tau=R*C;
for i =0:1:75
vss=E+Iinj(i)*R;
V(i+1)=vss-(vss-V(i))*exp(-(t(i+1)-t(i))/tau);
end
plot(t,V)
댓글 수: 0
채택된 답변
per isakson
2019년 3월 12일
MATLAB has indexing of arrays beginning from 1 instead of 0, thus replace
for i =0:1:75
by
for i =1:1:76
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!