MATLAB Assignment due 11/9
Do we need to generate Phi and Phi_q for each of these joints? I guess we will eventually.
The reason I ask, is because some of the C(t) functions are going to be constant when we take their derivative. We were told to set up our matlab functions using handles (i.e. C(t)), but as far as I know we still haven't solved the error when you try and take C(t) when C(t) is constant.
Now,
if you say t=2
then
eval(Csym) = 8
C(t) = 8
eval(CPrimeSym) = 8
CPrime(t) = 8
eval(CDblPrimeSym) = 4
CDblPrime(t) = error
Should we abandon handles and switch to the eval function and symbolic equations?
The reason I ask, is because some of the C(t) functions are going to be constant when we take their derivative. We were told to set up our matlab functions using handles (i.e. C(t)), but as far as I know we still haven't solved the error when you try and take C(t) when C(t) is constant.
Example:
syms t
Csym = sym(t^2*2);
C = matlabFunction(Csym);
CPrimeSym = diff(Csym);
CPrime = matlabFunction(CPrimeSym);
CDblPrimeSym = diff(diff(Csym));
CDblPrime = matlabFunction(CDblPrimeSym);
returns
Csym = 2*t^2
C = @(t)t.^2.*2.0
CPrimeSym = 4*t
CPrime = @(t)t.*4.0
CDblPrimeSym = 4
CDblPrime = @()4.0
Now,
if you say t=2
then
eval(Csym) = 8
C(t) = 8
eval(CPrimeSym) = 8
CPrime(t) = 8
eval(CDblPrimeSym) = 4
CDblPrime(t) = error
Should we abandon handles and switch to the eval function and symbolic equations?
Last edited by Anonymous on Thu Nov 04, 2010 7:01 pm, edited 1 time in total.