array of anonymous function

4 vues (au cours des 30 derniers jours)
david
david le 25 Juin 2023
Commenté : david le 26 Juin 2023
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

Réponse acceptée

Matt J
Matt J le 25 Juin 2023
Modifié(e) : Matt J le 25 Juin 2023
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 commentaires
Paul
Paul le 25 Juin 2023
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 le 26 Juin 2023
Thank, i see it later.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Performance and Memory dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by