the derivative of determinant
Show older comments
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.
4 Comments
abhijit kulkarni
on 6 May 2014
The dimension of k is 2 x 200002 here.
I suppose MATLAb expect square matrix.
Make it appropriately 2x2
abhijit kulkarni
on 6 May 2014
Edited: Andrew Newell
on 6 May 2014
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 ];
size(k)
Somehow make it square (not necessarily 2x2)
Andrew Newell
on 6 May 2014
I think you'll need to describe the problem you're trying to solve. Without more information I can only guess how to make it square.
san -ji
on 6 May 2014
Accepted Answer
More Answers (0)
Categories
Find more on Correlation and Convolution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!