how to solve "Undefined function" problem?

I am writing a code where i used melcepsta function and it worked fine for the first time. Later I closed Matlab completely and opened it 3 days later to run the same program, but it did not run and it gave me this error.. "Undefined function 'Melcepsta'". Before running the program after 3 days it asked whether to change the path of the .m file or add to the path.. I selected add to the path.. I have attached the .m and .fig file along. Please, any help will be appreciated.

1 件のコメント

mohanish
mohanish 2018 年 9 月 24 日
the files which I am working on are these

サインインしてコメントする。

 採用された回答

OCDER
OCDER 2018 年 9 月 24 日

0 投票

Add the path where your missing function is to your Matlab working path. Read more here.

6 件のコメント

mohanish
mohanish 2018 年 9 月 24 日
how to add the path?
OCDER
OCDER 2018 年 9 月 24 日
addpath('C:\User\MyUserName\MyMatlabFolder\MelcepstaFolder\')
something like that.
mohanish
mohanish 2018 年 9 月 25 日
i am not able to understand. Can you explain this in my code?
OCDER
OCDER 2018 年 9 月 25 日
Where is your missing melcepsta.m file located on your hard drive? You need to let Matlab know where to look for this file, and to do that, you use addpath. You do this OUTSIDE of your code, directly on the Matlab command prompt. Imagine if Record.m is located C:\MyFolder, and melcepsta.m is located in F:\MyHiddenFolder. Matlab will have no idea about where melcepsta.m is, so when Record.m in line 113 says
d = melcepsta(myRocording)
Matlab gets lost - Undefined function melcepsta. By using addpath, you tell Matlab "hey, search here for that file".
If you can't figure out how to use pathing, then place melcepsta.m in the same folder as your Record.m file.
addpath('C:\Folder_Where_Melcepsta_Is')
then run your GUI
Record
mohanish
mohanish 2018 年 9 月 26 日
Thank you so much Man! It worked. That was a stupid mistake!
OCDER
OCDER 2018 年 9 月 26 日
You're welcome!

サインインしてコメントする。

その他の回答 (1 件)

Wilbert Clarke
Wilbert Clarke 2024 年 4 月 10 日

0 投票

J = 0.02;
b = 0.1;
K = 0.01;
R = 1.1;
L = 0.5;
numerator = K;
denominator = [J, b, K^2];
M = tf(numerator, denominator);
T = feedback(M, 1);
C = 1/s;
one_minus_T = 1 - T;
E_ss = limit(s * C * one_minus_T, s, 0)

1 件のコメント

Stephen23
Stephen23 2024 年 4 月 10 日
What value do you expect s to have?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDebugging and Analysis についてさらに検索

質問済み:

2018 年 9 月 24 日

コメント済み:

2024 年 4 月 10 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by