array of anonymous function
9 ビュー (過去 30 日間)
古いコメントを表示
hello,
I need help on anonymous function.
i need to calc array of obj [obj1, obj2, obj3] in loop each time , i call to obj with syms V and parameters value I0, IL, Rs, Rp, Vt_Ta which define before.
i try to define clussdef of obj, but get an errore.
Thanks a lot
for k=1:3
obj = @(V) I_fun(V, I0, IL, Rs, Rp, Vt_Ta) - target_value;
fplot(obj{k},[0 55],'LineWidth',2);
end
0 件のコメント
採用された回答
Matt J
2023 年 6 月 25 日
編集済み: Matt J
2023 年 6 月 25 日
clear obj
for k=3:-1:1
obj{k} = @(V) I_fun(V, I0, IL, Rs, Rp, Vt_Ta) - target_value;
fplot(obj{k},[0 55],'LineWidth',2);
end
5 件のコメント
Paul
2023 年 6 月 25 日
did the error arise because the for loop index variable is k (lower case) , but the index variable into the obj cell array is K (upper case)?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Performance and Memory についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!