Undefined function for input arguments of type 'double' during Simulink
12 views (last 30 days)
Show older comments
Beatrice Pazzucconi
on 24 May 2019
Commented: Walter Roberson
on 10 Jan 2023
Hello everyone, I created a simple script (TMAP.m) that has the current body:
function y = TMAP(u)
A = 40e+03;
B = 15e+03;
n = 1;
y = A*(u.^n).*exp(-B*u);
end
And I added the block "Interpreted Matlab function" to my Simulink model. I indicated "TMAP.m" in the block properties, fed a digital clock as input and connected to output to a scope. The TMAP script is in the same folder as the Simulink model. When in workspace I create a dummy input vector, say 0:0.001:0 and feed it to TMAP (eg y = TMAP(0:0.001:1)) it works just fine. When I try to run the Simulink model, I get these errors:
- Undefined function 'TMAP.m' for input arguments of type 'double'.
- Error evaluating MATLAB function in 'VelocitySelectiveRecordingTMAP/TMAP'
Can anybody tell me what I am doing wrong?
THank you very much for your help
NB - tried also having TMAP doing y = sin(u) to be sure but still refuses to work
5 Comments
wei-jay ling
on 9 Jan 2023
Edited: wei-jay ling
on 9 Jan 2023
Hi, I have same problem, but I don't know your mean.
If I change the file name (like planer.m become planerA.m) then the system will show the warning to me.
the problem show below,please help me.


Walter Roberson
on 10 Jan 2023
The original poster had the problem that inside their simulink block, at a place that they needed to refer to function TMAP they instead referred to function TMAP.m -- the file name instead of the function name. This had nothing to do with renaming anything, just with changing the way the function was referred to in the code.
There should be no need to rename planer.m to planerA.m .
If you do rename a file that has a function inside it as the first line non-comment, then you might get a warning message that the name in the function statement does not match the name of the file. If you renamed planer.m to planerA.m then best practice would be to also rename function planer inside the now-called planerA.m to function planerA inside that file.
In your case, Simulink is trying to find a function named planar (with an ar not an er) but is not succeeding. If you do have a planar.m file then it is not anywhere on your MATLAB path. You should consider using pathtool to ensure that th directory containing planar.m is on your MATLAB path.
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!