how to implement this in a better way or what is the mistake
조회 수: 2 (최근 30일)
이전 댓글 표시
baiscally I have the excel sheet 'data3' attached above, this sheet contaians data from satellites over a 24 hour period, what I am doing is that I first need to read the coordinates of the satellite denoted by xs,yxs and zs. then we use some formula to find the coordinates for the reciever location denoted by X,Y,Z.
the two variables N and counter_1 are baisiclly the start and the end of the data for every 30 second in the 24hrs, meaning if we have N=1 and counter_1=8 this means that we have 8 values for xs,ys,zs for the first 30 second of the 24hr then we increment the N to be counter_1+1 to move the next 30 econds and so on.
Now what I need to do is to calculate the ax,ay,az for each 30 second in the 24hrs we have, then store the values in a matrix H such that each raw contains the values of ax,ay,az and 1 at the forth column (for some reason).
I am not sure if the way I am implementing the ax,ay,az is correct or not so maybe this is the issue. or maybe I need to do some manipulating with the xs,ys,zs or the X,Y,Z to make them fit in the equation.
example: to calculate ax,ay,az for the first 30 seconds, we should read the xs,ys,zs for the fisrt 30 second and use the X,Y,Z we calculate earlier and plug all this in the given equations for the ax,ay,az after that we should fill the matrix H with these values.
the error i am keep getting is
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
Error in receiver_location3 (line 45)
ax(N:counter_1)=(xs-X)/r;
댓글 수: 6
Jan
2021년 7월 21일
Image Analyst has posted 6 command, your code has 7 outputs. Please calrify, which variable has which size.
답변 (1개)
Jan
2021년 7월 21일
편집: Jan
2021년 7월 21일
Use the debugger:
dbstop if error
Run your code afterwards until Matlab stops at the error. Then check:
size((xs-X)/r)
size(N:counter_1)
Does this match? You see, where the problem is and why this assignment cannot work. This should be sufficient to find the cause of the problem.
댓글 수: 4
Jan
2021년 7월 23일
I do not understand, what this line of code should do. Seeing a failing code does not allow to fix it (usually), but an exact description of the purpose is required.
What does "still did not work" mean?
In (xs-X)/r xs is [1 x 8], X is scalar, r is [1 x 8] and the wanted output is [1 x 8]. So what do you want to calculate and why does (xs-X) . /r "still not work"?
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!