Skip to content

Instantly share code, notes, and snippets.

@kor01
Last active November 2, 2017 23:31
Show Gist options
  • Save kor01/5bcf675cc7bd5e2f62f78f5b12e90ac0 to your computer and use it in GitHub Desktop.
Save kor01/5bcf675cc7bd5e2f62f78f5b12e90ac0 to your computer and use it in GitHub Desktop.
[matlab robotics] #robotics #matlab
hold on
plot(x(1, :), x(2,:))
% declaration
syms v u
w = 2*v + u
% differentiation
diff(w, v)
% define functions
syms a b c x
f(x) = a*x^2 + b*x + c
% evaluate function
syms r
fr = f(r)
f3 = f(3)
%evaluation sybolic expression
% substitude in expression of w, set v=5
subs(w, v, 5)
% subsititude with another variable
subs(w, v, x)
% get numeric answer
w = v + 1/2
subs(w, v, 4)
vpa(subs(w,v,4))
% generate a symbolic matrix
A = sym('a', [3, 6])
% define a symbolic rotation
syms theta, d
T = [cos(theta) -sin(theta) 0; sin(theta) cos(theta) 0; 0 0 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment