why is my code giving me a parse error
이전 댓글 표시
this is my code:
x=0.1;
beats=A(1,30);
for k=1:30
A=2x*(1-x);
x=A;
disp(A)
end
when i run this i get a parse error and A undefined
I am not familiar enough with MATLAB syntax to figure out what it even means, let alone how to fix it. Any ideas? Thank you!
답변 (1개)
David Hill
2021년 10월 9일
편집: David Hill
2021년 10월 9일
x=0.1;
%beats=A(1,30); There is no A defined and you are indexing into it!
for k=1:30
A(k)=2*x*(1-x); %need 2*, if you want to keep track of all iterations, index into A
x=A(end);
%disp(A)
end
disp(A);%display outside loop
댓글 수: 4
zidan masood
2021년 10월 9일
David Hill
2021년 10월 9일
I code above runs. You never used beats. What where you trying to do with beats?
zidan masood
2021년 10월 9일
David Hill
2021년 10월 9일
I will get you started
HeartRate=.1;
Time=0;
t=table(Time,HeartRate);
%your loop
for k=1:30
t.Time(k)=k+1;
t.HeartRate(k)=
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!