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

2 ビュー (過去 30 日間)
Joris Alis
Joris Alis 2016 年 3 月 23 日
コメント済み: Joris Alis 2016 年 3 月 23 日
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.

回答 (1 件)

Mike Garrity
Mike Garrity 2016 年 3 月 23 日
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.

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by