clear all
close all
clc

syms R L C
syms q1 q2 A B
syms ka1 ka2 kb1 kb2
        f = [q1+R*cos(q2)+L*cos(A)-B;
             R*sin(q2)-L*sin(A)-C];
         
s=[A; B];
q=[q1; q2];
K=[ka1 ka2; 
   kb1 kb2];

J = jacobian(f,s)

Q=jacobian(f,q)

for i=1:size(s,1)
    dJds(:,i)=diff(J(:,i),s(i));
end
dJds

dJdq=dJds*diag(K)
for i=1:size(q,1)
    dQdq(:,i)=diff(Q(:,i),q(i));
end
dQdq
