Using the operator @ and the function

2 visualizaciones (últimos 30 días)
ektor
ektor el 7 de Mayo de 2019
Editada: Torsten el 7 de Mayo de 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 comentarios
ektor
ektor el 7 de Mayo de 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 el 7 de Mayo de 2019
Editada: Torsten el 7 de Mayo de 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 ?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Elementary Math en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by