필터 지우기
필터 지우기

matrix entry into function

조회 수: 1 (최근 30일)
Jiung Shin
Jiung Shin 2020년 12월 6일
답변: Cris LaPierre 2020년 12월 6일
In a matrix A, I have assinged x(t)=A(t,2)
But if I want to calculate x(t+1)-x(t), it returns an error. How can I fix? Matlab doesn't specify which error I have made.
+ is it possible that I write a function and when I execute it it returns a message with enter "t" so I don't have to rewrite the code for different t? I think I did something similar in python or some other language but I'm not sure with matlab.
  댓글 수: 1
KSSV
KSSV 2020년 12월 6일
편집: KSSV 2020년 12월 6일
Show us your code. Or how A is related to t.

댓글을 달려면 로그인하십시오.

답변 (1개)

Cris LaPierre
Cris LaPierre 2020년 12월 6일
Also, share the complete error message (all the red text),
My suspicion is that x(t+1) does not exist.
x=1:5;
t=5;
x(t+1)-x(t)
Index exceeds the number of array elements (5).

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by