Hi! I have a problem about differentiating determinant.I don't know how to make it. I got these message:"Matrix dimensions must agree." ,"Inputs must be a scalar and a square,and "Inner matrix dimensions must agree." when I added "." somewhere. Thanks for helping!
h = 0.001;x = 0:h:100;m = 5;h = 2*pi.*x;q= besseli(5,h);k = [m*q.*(h-3)*5 5*5*h ; q.*6-h.^2 q.*h-2 ];c = diff(det(k));
—————————————————————————-
I revised my code here:
f = 0.001;
x = 1:f:5;
w = 2*pi*x;
k = [cos(w), 0; 0, cos(w) ];
detk = k(1,1)*k(2,2)-k(2,1)*k(1,2);
c = diff(detk)/f;
plot(x,detk,x,[0 c],'r:')
I want to differentiate detk to f.But after I run it,my matrix c is empty. Can anyone tell me what is wrong? Thanks.
Best Answer