Filter löschen
Filter löschen

how to plot Zakharov function? Can anyone help me pls

4 Ansichten (letzte 30 Tage)
huma
huma am 27 Apr. 2017
Beantwortet: Roger Stafford am 27 Apr. 2017
I want to plot a 2D surface plot of zakharov test function
  3 Kommentare
huma
huma am 27 Apr. 2017
Bearbeitet: dpb am 27 Apr. 2017
Thank u.... but i am not getting graph as shown in the below link https://www.sfu.ca/~ssurjano/zakharov.html
dpb
dpb am 27 Apr. 2017
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Roger Stafford
Roger Stafford am 27 Apr. 2017
[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)

Community Treasure Hunt

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

Start Hunting!

Translated by