Surf dimensions do not agree. Help!

3 次查看(过去 30 天)
fadams18
fadams18 2019-2-4
编辑: Stephan 2019-2-4
Hello Matlabers!
I want a surf plot 3 variables but have a dimension problem. please see my code below.
SNRR=[15,30,50];
MV_raw=[0.1:0.1:0.9,0.95,0.99];
Median= 3x10 matrix;
surf( [0.1:0.1:0.9,0.95,0.99],SNRR,Median,'FaceColor',[0 1 0],'FaceAlpha',0.5);
% Error using surf (line 71)
% Data dimensions must agree.
Please help what am i doing wrongly. it was working initially when i had just [0.1:0.1:0.9] but I added more points 0.95 and 0.99 and it not working anymore :D

回答(1 个)

Stephan
Stephan 2019-2-4
编辑:Stephan 2019-2-4
Hi,
the reason for your problem is:
SNRR: 1x3
MV_raw: 1x11
Median: 3x10
This does not work. Either change MV_raw to 1x10 or Median to 3x11.
For example try:
SNRR=[15,30,50];
Median = ... 3x10 Matrix
MV_raw=[linspace(0.1,0.9,8), 0.95, 0.99];
surf(MV_raw, SNRR ,Median, 'FaceColor',[0 1 0],'FaceAlpha',0.5);
Best regards
Stephan
  2 个评论
fadams18
fadams18 2019-2-4
doesnt work how i want it. ive edited my code and now my variable are
SNRR: 1x3
MV_raw: 1x11
Median: 5 x11
when i do linspace(0.1,0.9,8), 0.95, 0.99];
0.10 0.21 0.32 0.44 0.55 0.68 0.78 0.90 0.950 0.99
% i prefar not to have approximations.
% plus 0.8 is missing.
Stephan
Stephan 2019-2-4
编辑:Stephan 2019-2-4
Why Median is 5x11 now? Then you need to change SNRR to 1x5 to make it run. Note:
1x3 and 1x11 will work with 3x11
1x3 and 1x10 will work with 3x10
1x5 and 1x11 will work with 5x11
...

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by