Using the operator @ and the function

조회 수: 2 (최근 30일)
ektor
ektor 2019년 5월 7일
편집: Torsten 2019년 5월 7일
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
ektor
ektor 2019년 5월 7일
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 2019년 5월 7일
편집: Torsten 2019년 5월 7일
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 ?

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Elementary Math에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by