Function : undefined function or variable
1 回表示 (過去 30 日間)
古いコメントを表示
ABDALLAH BOINA Safinati-Amir
2020 年 11 月 8 日
コメント済み: ABDALLAH BOINA Safinati-Amir
2020 年 11 月 8 日
Hello,
i'm wrote a function fun in a "Vc.m" file and i have to use it in the lsqcurvefit function that i wrote in another file "Identification.m" to find the constants b,m and R as shown below. In my first file i have the message "The function f might be unused" could someone help me please ?
Vc.m
function [Vc] = fun(j,b,m,R)
Vc(j) = E0-b.*log(j)-R.*j-m.*exp(n.*j);
end
Identification.m
j = [5 30 55 80 105 130 155 180 205 230 255 280 305 330 355 380 405 430 ...
455 480 505 530 555 580 605 630 655 680 705 730 755 780 805 830 855 880];
V80 = [1.0020 0.9448 0.9229 0.9037 0.8942 0.8810 0.8723 0.8630 0.8548 0.8427 ...
0.8379 0.8272 0.8152 0.8108 0.8025 0.7921 0.7882 0.7806 0.7770 0.7691 ...
0.7635 0.7552 0.7473 0.7406 0.7347 0.7300 0.7222 0.7099 0.7065 0.6985 ...
0.6932 0.6835 0.6793 0.6679 0.6561 0.6543];
x0 = [0;0];
E0 = 1.5;
n = 8.0E-3;
v80 = lsqcurvefit(@fun,x0,j,V80);
0 件のコメント
採用された回答
dpb
2020 年 11 月 8 日
"wrote a function fun in a "Vc.m" file"
but the function
function [Vc] = fun(j,b,m,R)
Vc(j) = E0-b.*log(j)-R.*j-m.*exp(n.*j);
end
is fun, not VC and so it should be saved in and referred to as fun.m not Vc.m
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Downloads についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!