Hello,
could anyone advise me how to make a cylinder from 2D matrix of a number of rows and columns eg x = rand(5,10). And then interpolate values around its perimeter and display it?
Best regards

 채택된 답변

Matt J
Matt J 2019년 3월 4일
편집: Matt J 2019년 3월 4일

1 개 추천

If you have the Image Processing Toolbox, you would use the warp command, e.g.,
[X,Y,Z] = cylinder(ones(1,5),100);
warp(X,Y,Z,rand(5,10));

댓글 수: 4

It works perfectly, but now I have one more question. How can I change colorbar from B/W to colored (typically RGB) ?
clc; clear all; close all;
[X,Y,Z] = cylinder(ones(1,5),100);
M = round(rand(5,10)*100);
figure
warp(X,Y,Z,M)
colorbar
caxis([0 100]) % rozmezi colorbaru
grid on
This code produce:
c1.PNG
And I want something like this (imagesc) around the cylinder. Exist some function?
c2.PNG
Matt J
Matt J 2019년 3월 5일
In the documentation for warp, you will see that it has options for providing a colormap or giving RGB data instead of grayscale.
Can't you just call colormap and specify the desired colormap?
colormap(jet)
martin martin
martin martin 2019년 3월 7일
Ben, thank you.
c3.PNG

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Blue에 대해 자세히 알아보기

질문:

2019년 3월 4일

댓글:

2019년 3월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by