How do I create a correct Z matrix from a 'one-value-per-participant' variable for contour plot?
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
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 Exchange 中查找有关 Contour Plots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!