how to plot Zakharov function? Can anyone help me pls
4 views (last 30 days)
Show older comments
I want to plot a 2D surface plot of zakharov test function
3 Comments
dpb
on 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.
Answers (1)
Roger Stafford
on 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)
0 Comments
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!