problem with determinant calculus

1 Ansicht (letzte 30 Tage)
zini giacomo
zini giacomo am 8 Feb. 2018
Kommentiert: Aveek Podder am 20 Feb. 2018
i've a problem in the calculus of the determinant of a matrix, which his components change in the time, the determinant calculated in the analytic way and with 'det' function results different.
function [w1,w]=singular5(q1,q2,t)
time=size(t);
time=time(2);
w=zeros(1,time);
w1=zeros(1,time);
for k=1:time
J=[-(sin(q1(k)+sin(q1(k)+q2(k)))) -sin(q2(k)) 0 0;-(cos(q1(k)+cos(q1(k)+q2(k)))) -cos(q2(k)) 0 0;0 0 1 0;1 1 0 1];
w1(k)=abs(sin(q1(k)-q2(k))+sin(q1(k)));
w(k)=abs(det(J));
end
% code
w1 and w result differnet!
  2 Kommentare
zini giacomo
zini giacomo am 8 Feb. 2018
Oops i've miss some parentesis
Aveek Podder
Aveek Podder am 20 Feb. 2018
Hi,
Hope this helps:
function [w1,w]=singular5(q1,q2,t)
time=size(t);
time=time(2);
w=zeros(1,time);
w1=zeros(1,time);
for k=1:time
J=[-(sin(q1(k))+sin(q1(k)+q2(k))) -sin(q2(k)) 0 0;-(cos(q1(k))+cos(q1(k)+q2(k))) -cos(q2(k)) 0 0;0 0 1 0;1 1 0 1];
w1(k)=abs(sin(q1(k)-q2(k))+sin(q1(k)));
w(k)=abs(det(J));
end

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by