Using the operator @ and the function

2 views (last 30 days)
ektor
ektor on 7 May 2019
Edited: Torsten on 7 May 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 Comments
ektor
ektor on 7 May 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 on 7 May 2019
Edited: Torsten on 7 May 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 ?

Sign in to comment.

Answers (0)

Categories

Find more on Elementary Math in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!