implementation of iterative function
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
How can we implement the iterative function F(x)= [((1-2*q)*(x-q))/(p-q)]+q we have to iterate it for some values of i and generate the values of xi where xi=F(xi-1). initially let.
採用された回答
Torsten
2015 年 3 月 19 日
n=...;
p=...;
q=...;
x0=...;
f=@(x)(1-2*q)*(x-q)/(p-q)+q;
for ii=1:n
xnew=f(xold);
xold=xnew;
end
Best wishes
Torsten.
8 件のコメント
shivani
2015 年 3 月 19 日
here xold=x0??? and we have to store all the values of xnew into a vector.
shivani
2015 年 3 月 19 日
with the help of this getting inf value of x in each iteration.
Torsten
2015 年 3 月 19 日
ok, replace
x0=...;
by
xold=...;
And don't use p=q -:)
Best wishes
Torsten.
shivani
2015 年 3 月 19 日
not using p=q still getting inf values. Im=imread(); [n m]=size(A); L=m*n; AVector = A(:); P=A; x0=0.27;p=0.4;q=0.1; xold=x0; f=@(x)(1-2*q)*(x-q)/(p-q)+q; for i=1:n; xnew=f(xold); xold=xnew; end for j = 1:numel(P) i = P(j); output(j) =xold end
@shivani: please learn to format your code correctly to make it readable: use the {} Code button that is above the textbox. The Preview pane is pretty handy too!
shivani
2015 年 3 月 19 日
not taking p=q still getting inf values.
Im=imread();
[n m]=size(A);
L=m*n;
AVector = A(:);
P=A;
x0=0.27;p=0.4;q=0.1;
xold=x0;
f=@(x)(1-2*q)*(x-q)/(p-q)+q;
for i=1:n;
xnew=f(xold);
xold=xnew;
end
for xi = 1:numel(P);
i = P(xi);
output(xi) =xold;
end
Torsten
2015 年 3 月 19 日
Im=imread();
[n m]=size(A);
L=m*n;
x0=0.27;
p=0.4;
q=0.1;
xold=x0;
output=zeros(L);
output(1)=xold;
f=@(x)(1-2*q)*(x-q)/(p-q)+q;
for ii=1:L-1
xnew=f(xold);
xold=xnew;
output(ii+1)=xold;
end
Note that xold becomes bigger and bigger during the Iteration such that you may get xold=Infinity if L is large enough.
Best wishes
Torsten.
shivani
2015 年 3 月 19 日
ok thanx..:)
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Inverse Gaussian Distribution についてさらに検索
参考
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
