필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Please help me understand my homework

조회 수: 1 (최근 30일)
Abdullah Tamimi
Abdullah Tamimi 2011년 11월 10일
마감: MATLAB Answer Bot 2021년 8월 20일
v(k+1)=v(k)+.0005(-.5*v(k)+c1*(75-v(k))+c2+h(k))
Create a MATLAB function CarOrbit.m with parameter inputs (c1, c2, hk) that plots the v(k) orbit. Plot the orbit for parameter values (c1, 0,−5). let c1=100, and determine stablity of the orbit
Here is the code i entered, and it kept giving me error message.
function carorbit(V1,C1,C2,H1,N)
V(1)=V1
C(1)=C1
C(2)=C2
H(1)=H1
t=[0:.01:N]
for k=[1:N-1]
V(k+1)=V(k)+.0005*(-.5*V(k)+C(1)*(75-V(k))+C(2)+H(k))
end
grid on
plot(t,V)

답변 (1개)

Honglei Chen
Honglei Chen 2011년 11월 10일
It seems that you never compute your H(k). So once k>1, there is no value for H(k).
  댓글 수: 2
Abdullah Tamimi
Abdullah Tamimi 2011년 11월 10일
awesome, so i changed H(k) to just H, and now it is telling me something about how it cannot plot because vectors are not the same
Honglei Chen
Honglei Chen 2011년 11월 11일
Well, your t is 0:0.01:N, which is 100*N+1 points long. But your V is only N points long, that's why they cannot be plotted. You redefine your t as 0:N-1, or 1:N, but it really depends your application.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by