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

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (1)

Mike Garrity
Mike Garrity il 23 Mar 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.

Categorie

Scopri di più su Contour Plots in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by