Borrar filtros
Borrar filtros

how to plot Zakharov function? Can anyone help me pls

4 visualizaciones (últimos 30 días)
huma
huma el 27 de Abr. de 2017
Respondida: Roger Stafford el 27 de Abr. de 2017
I want to plot a 2D surface plot of zakharov test function
  3 comentarios
huma
huma el 27 de Abr. de 2017
Editada: dpb el 27 de Abr. de 2017
Thank u.... but i am not getting graph as shown in the below link https://www.sfu.ca/~ssurjano/zakharov.html
dpb
dpb el 27 de Abr. de 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.

Iniciar sesión para comentar.

Respuestas (1)

Roger Stafford
Roger Stafford el 27 de Abr. de 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)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by