How do I create a correct Z matrix from a 'one-value​-per-parti​cipant' variable for contour plot?

2 visualizaciones (últimos 30 días)
Hello, I’m not very familiar with MATLAB and not a good mathematician either. I hope you could help me with contour plots. Let’s say my 3 variables are x=Age (31x1), y=Estimated cranial volume (31x1), and z=Estimated IQ score (31x1). Each variable has only 1 value per participant. When I define my variables and enter the line ‘contour(x,y,z)’, I get a message that my ‘z must be at least 2x2 matrix’. How should I convert my z variable so that it complies to this rule? Thank you.

Respuestas (1)

Mike Garrity
Mike Garrity el 23 de Mzo. de 2016
Functions like contour want gridded data, and you have scatter data. You'll need to do a gridding operation to convert your data into the correct form.
I wrote about this recently on the MATLAB Graphics blog, but that just covers a few basic techniques. Gridding data is a pretty rich field, and MATLAB has a lot of tools for doing it.

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by