フィルターのクリア

how to plot Zakharov function? Can anyone help me pls

4 ビュー (過去 30 日間)
huma
huma 2017 年 4 月 27 日
回答済み: Roger Stafford 2017 年 4 月 27 日
I want to plot a 2D surface plot of zakharov test function
  3 件のコメント
huma
huma 2017 年 4 月 27 日
編集済み: dpb 2017 年 4 月 27 日
Thank u.... but i am not getting graph as shown in the below link https://www.sfu.ca/~ssurjano/zakharov.html
dpb
dpb 2017 年 4 月 27 日
Well, I didn't try to read it; just noted the respondent seemed happy...I guess from your link I don't fully follow how the function is to be evaluated...what is d, precisely? If it's actually the dimensionality of the hypercube then for your case it would seem to be 2; is that correct? If that's the case, it looks to me as though the implementation in that link isn't correct as it sums over the length of the input vector, not the dimensionality.
gargle,gargle...aha! Here's a guy I think has it right...
http://www.al-roomi.org/component/content/article?id=196:zakharov-s-function see if following his code doesn't lead you somewhere closer to where you're headed.
If this is correct, still could be more efficient with meshgrid and vectorized, but would have to write a function to handle the dimensionality; this script here has n=2 hardcoded.

サインインしてコメントする。

回答 (1 件)

Roger Stafford
Roger Stafford 2017 年 4 月 27 日
[X1,X2] = meshgrid(linspace(-10,10,81));
T = .5*1*X1+.5*2*X2;
Z = X1.^2+X2.^2+T.^2+T.^4;
surf(X1,X2,Z)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by