SIMULINK errors in running PID/figures/afmtap_step.m

Issue #2 resolved
Richard Murray repo owner created an issue

There seems to be a problem when running afmtap_step.m using MATLAB 2013a. The following error message occurs:

Error using afmtap_step (line 23)
Error evaluating parameter 'Gain' in 'afmtap/Gain1'
    Error using afmtap_step (line 23)
    Undefined function or variable 'k'.
Error using afmtap_step (line 23)
Error evaluating parameter 'Numerator' in 'afmtap/Transfer Fcn1'
    Error using afmtap_step (line 23)
    Undefined function or variable 'ki'.
Error using afmtap_step (line 23)
Error evaluating parameter 'DelayTime' in 'afmtap/Transport Delay'
    Error using afmtap_step (line 23)
    Undefined function or variable 'T'.

This problem has occurred before and has to do with the way that variables in a SIMULINK diagram are accessed within MATLAB. Need to reconstruct what the right fix is.

Comments (2)

  1. Richard Murray reporter

    Fixed in commit #921a9d7. Need to set SIMULINK parameters using the set-arms command. For this error, the commands to use are

    set_param('afmtap/Gain1', 'Gain', num2str(k));
    set_param('afmtap/Transfer Fcn1', 'Numerator', num2str(ki));
    set_param('afmtap/Transport Delay', 'DelayTime', num2str(T));
    
  2. Log in to comment