How can I plot a matrix as a colored grid?

2 ビュー (過去 30 日間)
Samuel Alonso
Samuel Alonso 2017 年 3 月 18 日
回答済み: Walter Roberson 2017 年 3 月 19 日
Hello,
I've been hitting hard at this for a while, but haven't been able to achieve it. I have a matrix whose values range from 0 to 300. I'd like to plot this matrix as a colored grid, where the Hue angle is given by the element of the matrix at that point, while keeping luminosity and saturation constant. How can I do this in MATLAB?

回答 (2 件)

Walter Roberson
Walter Roberson 2017 年 3 月 19 日
H = double(YourMatrix)/360;
hsv = H;
hsv(:,:,2) = TheConstantStaturation;
hsv(:,:,3) = TheConstantValue;
rgb = hsv2rgb(hsv);
image(rgb); %or imshow(rgb)

Florian
Florian 2017 年 3 月 19 日
Is the function pcolor maybe what you are looking at?

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by