Using the operator @ and the function

2 vues (au cours des 30 derniers jours)
ektor
ektor le 7 Mai 2019
Modifié(e) : Torsten le 7 Mai 2019
Dear all,
I have a function
function ll=sample(x,a,b,c,d)
end
, where x appears in 1000 equations in various positions.
I am using an algorithm that works as follows for a simple function LL
LL=@(x) x.^2 ;
[output]=Algorith(LL,xz,e,r);
How can I adjust my function ''ll' so that I can use this algorithm?
Many thanks
  3 commentaires
ektor
ektor le 7 Mai 2019
Thank you.
I have a 500 by one vector. Each element of this vector appears in 1000 equations.
I want to update each of these elements, one at a time. Each time, the element which should be updated is my 'x'
To this end, I found a function from an author to do that but it has the above simple template;see the LL example, where 'x' appears in a single equation
However, in my case 'x' appears in thousands of equations.
I want to tell the ALGORITH that I want to update x that belongs to thousands of equation?
But I use 'function', whereas the ALGORITHM uses the operator @
Torsten
Torsten le 7 Mai 2019
Modifié(e) : Torsten le 7 Mai 2019
Your second example can equivalently be written as
output = Algorith(@sample,xz,e,r)
function LL = sample(x)
LL = x.^2;
end
Can you take it from here ?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Elementary Math dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by