array of anonymous function

조회 수: 7 (최근 30일)
david
david 2023년 6월 25일
댓글: david 2023년 6월 26일
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

채택된 답변

Matt J
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
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)?
david
david 2023년 6월 26일
Thank, i see it later.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Performance and Memory에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by