Any idea how i could solve this. Does any one know how to plot contour of functions which takes in one value like the above. Any time i try to plot the above function, it tells me that z must be atleast a 2x2. But i am taking in only one input and giving out a vector, how can it give out a matrix of atleast 2x2 inorder to plot the contour?

A contour plot typically shows lines of equal value over a two dimension area.
Elevation above sea level as a function of longitude and latitude is one example.

What is your two dimensional map?
What are the units of your equal value lines?

Contours are usually associated with continuous functions?
What is the rand() function for?

At a more basic level, what are you hoping to accomplish?

Thanks d-glitch. Basically i have a function name func in my code above. I generate a random number 50 x 2 matrix using rand() from here: So the rand() is to generate some random values.

The function returns an array for vectors which are 50 x 1. I try to plot contour of the resulting eva by doing This: My 2 dimensional map is This [X1, X2] = meshgrid(c, c) as it is shown here:

But any time i run this, it tell me that eva, has to be a matrix of atleast 2x2. As it is now it just give a matrix of 50 x 1. I need eva to be atleast 2x2 matrix so that i can plot the contour. I am now seeking for advice how to do this. Is there a way i can plot the contour? Any suggestion?

0

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

If you know the elevations at the corners of section of a map, you may be able to map the contour lines inside that section.

If you want to draw contours at 10 foot intervals, you interpolate along the edges to find all the interval values and then connect the points.

I have attached an example for a simple 2x2 matrix that represents one small map element.

I don't know what contours on a 1-D array could possibly mean.
Could you make a drawing showing the sort of plot you would like to see? Contour-Plot-for-ExEx.pdf

Attached is what i am trying to achieve. I am trying to come up with a 3-D map for a 2-D function as shown in the attachment. The eva is supposed to be the third dimension which according to contour plot should be atleast a 2x2 matrix. My problem is eva is a 50x1. SampleSchwefel.jpg

In your example, the data file is probably a 2D matrix with dimensions of 21x21. It could have finer or coarser resolution.

But at 21x21, there would be 441 data values representing the z-axis value/height of the function at
x = -100, -9-, -80, ...0, 10, 20, ... 100 and y = -100, -9-, -80, ...0, 10, 20, ... 100

In your example, the contour plot is the flat 2D plot at z=-460, not the colorful squarish cone that rises over it.

There are no random variables in your example.

Your first step should probably be to make a 2D matrix that samples your function at discrete points. Once you have a function, you can think about ways to plot it.

And I still don't know what you are trying to do or why you are trying to do it.
Are you really trying to do something with Genetic Algorithms and the Schwefel function?

My x and y array each have 1x20 dimension. and f is also 1x20. I need a strategy that cam make f 2x2 or more. say 20x20. In this way i can plot the contour just like the example you as me to try. I am trying to plot contour of function tteee1 above.

The example you give involves x and y, which will surely work in a for loop, but in my case i only have one input which is x. How can it have the function f to output atleast a 2x2 matrix when only one input is given?

Are you really trying to do something with Genetic Algorithms and the Schwefel function?

Yes, i am actually try to implement Estimation of Distribution Algorithm (EDA) in Evolutionary Computation to understand it. I am trying to test it on Benchmark functions in 2d and i am having trouble with plotting contour of some of them, and Schwefel function is one of them.

This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210 (2 * 3 * 5 * 7) or 2310 (2 * 3 * 5 * 7 * 11).
The larger templaâ€¦