Using the operator @ and the function

4 ビュー (過去 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 Center および File ExchangeElementary Math についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by