如何使用一个沿Z轴变化一个变量的矩阵绘制pcolor样式的3-D图? [英] How do you plot the 3-D plot for pcolor style using one matrix with varying one variable along Z-axis?
问题描述
我得到 RFM
方阵 size(64 * 64)
作为 x的函数
和 h
变量如下所示。 x =由(pX2)组成的输入信号,其中 p
可以是任意大小,h =每个 RFM $的阈值(1X1)分别地。对于所有变化的
h
, x
是相同的常数。假设h处于这个范围内, h = [0:0.2:1]
RFM =函数(x,h)
-
x = rand(100X2)
和h_1 = 0
然后我将得到<$ c $ (64X64)矩阵的c> RFM_1 。 -
x是相同的,x = rand(100X2)
和h_2 = 0.3
然后我将获得RFM_2
的(64X64)矩阵。 -
x是相同的,x = rand(100X2)
和h_3 = 0.6
然后我将获得RFM_2
的(64X64)矩阵
我已经在pcolor图中绘制了 RFM_1
,并且还为每个 RFM
值绘制了 pcolor
情节。
我希望使用 pcolor
样式的RFM矩阵的3d图,其中<$在Z轴上为c $ c> h 。它应该查找每个 RFM
矩阵图,一个叠加在另一个之上吗?我如何在MATLAB中执行此操作?
预期的输出图应如下所示。在此图中,此图中仅绘制了一个 RFM_1
和 h_1
矩阵。我希望在 h_2 = 0.5
的 RFM_2
矩阵,依此类推,每个都用 pcolor
样式。
我在此处共享了所需的代码。您可以使用 test.m
文件检查上述功能。
I get RFM
square matrix size(64*64)
as function of x
and h
variable shown below. x = input signal consisting of(pX2),where p
can be of any size and h = threshold value (1X1) for each RFM
matrix respectively. x
is same constant values for all varying h
. let's say for example h will be in this range,h = [0:0.2:1]
RFM = function(x,h)
x=rand(100X2)
andh_1 = 0
then i will getRFM_1
of (64X64) matrix.x is same, x=rand(100X2)
andh_2 = 0.3
then i will getRFM_2
of (64X64) matrix.x is same, x=rand(100X2)
andh_3=0.6
then i will getRFM_2
of (64X64) matrix
As of now i have plotted RFM_1
in pcolor plot and also for each RFM
value i have plotted with pcolor
plot.
I want the 3d plot for the RFM matrix in pcolor
style with varying function of the h
in Z-axis. It should look for each RFM
matrix plot is stacked one above the other? How can i do this in MATLAB?
Expected output plot should somewhat look like below. Here,only one RFM_1
with h_1
matrix is plotted in this figure. I expect RFM_2
matrix at h_2=0.5
and so on plotted each withpcolor
style.
I have shared the required code here. You can use test.m
file to check the above function. https://drive.google.com/folderview?id=0B0sYDrkkEHQ-b25GMlphUEFRcDA&usp=sharing
here's a way if I understand you correctly:
data=peaks(64); % fake data
t=-0:8; % some thersholds
tdata=bsxfun(@gt,data,permute(t,[3 1 2])); % 3d threshold
data3=repmat(data,[1 1 numel(t)]); %just copy data to the 3rd dim
A=data3.*tdata;
A(A==0)=NaN; % this will eliminate showing the zero values
% plottning
h=slice(A,[],[],1:numel(t));
set(h,'EdgeColor','none','FaceColor','interp');
alpha(0.5);
这篇关于如何使用一个沿Z轴变化一个变量的矩阵绘制pcolor样式的3-D图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!