필터 지우기
필터 지우기

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 CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by