Info

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

Error when I try to use Code Analyzer suggestions

조회 수: 1 (최근 30일)
Andrew Farsech
Andrew Farsech 2015년 12월 12일
마감: MATLAB Answer Bot 2021년 8월 20일
I get the following warning: INV is slow and inaccurate. Use A\b for INV(A)*b , and b/A for b*INV(A)
the warning happens at at these 3 lines
a = a1 + p1*Z'*inv(f1)*(vt);
p = p1 - p1*Z'*inv(f)*Z*p1;
s(t,:) = v'*inv(f)*v;
I have tried to follow the suggestion without success. Probably I haven't understand the right equivalent syntax.
How I should write these code lines?
  댓글 수: 2
jgg
jgg 2015년 12월 12일
It's just a warning; you don't have to fix it. The inv function, as it suggests, is slow and inaccurate. I think if I understand your code properly, the corrected version would be:
a = a1 + ((p1*Z')/f1)*(vt);
p = p1 - ((p1*Z')/f)*Z*p1;
s(t,:) = (v'/f)*v;
If you're getting an error, check the dimensions of the matrices to make sure they align.
Andrew Farsech
Andrew Farsech 2015년 12월 13일
thanks, I know that it's only a warning not an error, the error happened in calculation because I have made a mistake in the attempt to follow the hint.

답변 (0개)

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by