??? Undefined function or method 'hw1_p2_x_vs_k' for input arguments of type 'double'. "

1 次查看(过去 30 天)
k=[1:i-1];
r_db = log10(r) .* 10;
k_db = k .* 10;
hw1_p2_x_vs_k(k,p,'power [W]');
%hw1_p2_x_vs_k(k,r,'snr');
hw1_p2_x_vs_k(k,r_db,'snr [db]');
hw1_p2_x_vs_k(k,e,'error of SNR');
hw1_p2_x_vs_k(k,alpha,'alpha');
hw1_p2_x_vs_k(k,p,'power [W]');
hw1_p2_x_vs_k(k,alpha,'alpha');
I get this error when I try to run this in my program
"hw1_p2_x_vs_k(k,alpha,'alpha');
??? Undefined function or method 'hw1_p2_x_vs_k' for input arguments
of type 'double'. "

采纳的回答

Walter Roberson
Walter Roberson 2011-11-10
I do not see anything obvious, but please recheck all of your code lines to be sure that all of them use h w digit-for-one, and that none of them use h w lower-case-L

更多回答(1 个)

Wayne King
Wayne King 2011-11-10
In addition to Walter's suggestion, also check that you have saved that function in a folder on the MATLAB path. If you enter
>>which hw1_p2_x_vs_k
You should get the path to that function returned. If you get 'hw1_p2_x_vs_k' not found, check your spelling carefully as Walter has suggested. If that is not the problem, make sure the folder (directory) that you have the functions in is listed when you enter
>>path
If not, use addpath (see the help) or pathtool
>>pathtool
to add the folder.

类别

Help CenterFile Exchange 中查找有关 Search Path 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by