필터 지우기
필터 지우기

how to iterate a code a certain number of times

조회 수: 2 (최근 30일)
Daniel Pitigala
Daniel Pitigala 2023년 9월 20일
답변: Pratyush Swain 2023년 10월 3일
Hello everyone
I have been devleoping a code for a kalman filter inside a mobile robot . The idea of this code is that it predicts and updates the position of the robot every 0.05 seconds up to 40 seconds. My code only calculates for one iteration while i need it to calculate for 800 iterations since there are 800 instances where the position needs to be calculated. I have tried putting it in a while loop but not sure as to why it is not working?. any help would be greatly appreciated. I have attached my code down below
Many Thanks
Daniel
  댓글 수: 2
Mathieu NOE
Mathieu NOE 2023년 9월 20일
we need your mat files as well
Daniel Pitigala
Daniel Pitigala 2023년 9월 20일
Hi Mathieu
I'll send them down below
thanks
Daniel

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

채택된 답변

Pratyush Swain
Pratyush Swain 2023년 10월 3일
Hi Daneil,
I understand you are facing issue in your while loop, I have been able to reproduce the same error and make out a key observation:
The variable r1_real holds a constant value and cannot be used with parenthesis. This can be illustrated as follows:
The r1_real holds a single element and cannot be used as an array containing multiple elements, hence r1_real(1,k) throws error in the second iteration with k=2.
The usage of dot operator in the code implies you are treating your variables as array but please verify the type of value held by the variable. You can investigate the same by using leveraging the workspace or command window.
Hope this helps.

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by