"Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. " RCOND = NaN. I'm using Newton's Method which uses a Jacobian Matrix for space mech. class. not sure how to fix w/out changing elements of matrix (set)

조회 수: 2 (최근 30일)
Eileen Endres 2021년 2월 17일
편집: Sai Sumanth Korthiwada 2022년 12월 20일
%% Create Guess vector
% [r3 ; r6 ;th3 ; th4 ; th5]
guess = [3;8;th3g;th4g;th5g];
% set up a tolerance value
t=10^-6;
error=2*t;
% Define initial and final input angle
% generate input vector
n=100;
th2=linspace(th2_start,th2_end,n)';
% matrix to hold results
guess_save = zeros(n,length(guess));
%% Jacobian
for i=1:n
while error > t
% Jacobian Matrix
J1=[-cos(guess(3)) 0 (guess(1)*sin(guess(3))) 0 0];
J2=[-sin(guess(3)) 0 (-guess(1)*cos(guess(3))) 0 0];
J3=[0 -cos(th6) 0 -r4*sin(guess(4)) -r5*sin(guess(5))];
J4=[0 sin(th6) 0 r4*cos(guess(4)) r5*cos(guess(5))];
J5=[0 0 1 -1 0];
J=[J1;J2;J3;J4;J5];
% Calculate the function values
f1=r2*cos(th2(i))-guess(1)*cos(guess(3))-r1*cos(th1);
f2=r2*sin(th2(i))-guess(1)*sin(guess(3))-r1*sin(th1);
f3=r4*cos(guess(4))+r5*cos(guess(5))-guess(2)*cos(th6);
f4=r4*sin(guess(4))+r5*sin(guess(5))-guess(2)*sin(th6);
f5=guess(4)- pi-guess(3);
% make a function vector
FUN=[f1;f2;f3;f4;f5];
% save our initial guess
guess_1=guess;
% calculate the new guess
guess= -J^-1*FUN+guess;
% calculate the error
error=max(abs(guess_1-guess));
end
% reset error
error =2*t;
% save guess value
guess_save(i,:)= guess;
end
댓글 수: 2없음 표시없음 숨기기
Eileen Endres 2021년 2월 17일
Any help would be much appreciated.
G A 2021년 2월 17일
편집: G A 2021년 2월 17일
what is it? Must be
and the others in a similar way

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

답변 (1개)

Sai Sumanth Korthiwada 2022년 12월 20일
편집: Sai Sumanth Korthiwada 2022년 12월 20일
Hi Eileen,
I understand that you are encountering a warning message while working on Newton’s method which uses Jacobian matrix.
%% Create Guess vector
%% Create Guess vector
% Use this:-

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by