Menu

Undefined function 'cadaCheckForDerivs' for input arguments of type 'struct' ---> how to use interp1?

Help
edamondo
2017-12-12
2018-01-12
  • edamondo

    edamondo - 2017-12-12

    Hello,

    I am trying to use adigator to find the derivative of the function defined below (saved in stateTransition.m).

    function ds = stateTransition(s,t) %(t, s, uTrans, uTransTime,uRot, uRotTime)
    % actually there needs to be 2 u : one fore the translation uT and one for
    % the rotation uR.
    
    % hardcode some stuff
        ds = zeros(6,1);
    
        uTrans = 0*ones(10,1)';
        uTransTime = 0:9';
    
        uRot = 0*ones(10,1)';
        uRotTime = 0:9';
    
        uTrans = interp1(uTransTime, uTrans, t);
        uRot = interp1(uRotTime, uRot, t);
    
        ds(1) = s(4);
        ds(2) = s(5);
        ds(3) = s(6);
        ds(4) = interp1([0,2,3,5,6,7,8,9,10]', [0,0.2244,0.3850,0.6309,0.7839,1.022,1.1630,1.3959,1.5340]', uTrans) * cos(s(3));
        ds(5) = interp1([0,2,3,5,6,7,8,9,10]', [0,0.2244,0.3850,0.6309,0.7839,1.022,1.1630,1.3959,1.5340]', uTrans) * sin(s(3));
        ds(6) = interp1((0:10:100)', [0, 6.3632, 16.8374, 25.6822, 35.5810, 45.7588, 53.0103, 60.5996, 83.5957, 89.0708, 96.1055]',uRot);
    end
    

    Unfortenately, it seems it doesn't accept the interp1. The commands I type are :

    x = adigatorCreateDerivInput([6 1],'x');
    t = adigatorCreateAuxInput([1 1]);
    adigator('stateTransition',{x,t},'myderiv');

    it displays the following error message :

    Undefined function 'cadaCheckForDerivs' for input arguments of type 'struct'.

    Error in cada/interp1 (line 103)
    elseif cadaCheckForDerivs(x) || cadaCheckForDerivs(y)

    Error in adigatortempfunc1 (line 33)
    ds(4) = interp1([0,2,3,5,6,7,8,9,10]',
    [0,0.2244,0.3850,0.6309,0.7839,1.022,1.1630,1.3959,1.5340]', uTrans) * cos(s(3));

    Error in adigator (line 647)
    [FunctionInfo, Outputs] = adigatortempfunc1(FunctionInfo,UserFunInputs);

    How can I fix this?

    Thanks for the program and for your help

     
  • Matthew J. Weinstein

    Hello,

    Sorry it took me awhile to get to this, there was an issue with the pure numeric inputs to interp1. I added a dummy cadaCheckForDerivs routine as a workaround. The 1.4.1 release and current code on SVN should fix this.

    Matt

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.