24小时热门版块排行榜    

查看: 2935  |  回复: 6
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

lzht1986

新虫 (小有名气)

[求助] 求教如何用MATLAB在三维图中插入各散点的误差条 已有1人参与

各位虫友求教一下怎么给这幅三维图中添加散点的误差条,谢谢了
求教如何用MATLAB在三维图中插入各散点的误差条
ZLC1)NPXHP$X99Q13)D03SH.jpg
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

lzht1986

新虫 (小有名气)

送红花一朵
引用回帖:
2楼: Originally posted by bucheron at 2014-02-11 00:41:18
errorbar(X,Y,E) X,Y,E 必须为同型参量。若同为向量,则画出带长度为 2*E(i)、对 称误差棒于曲线点(X(i),Y(i))之处;若同为矩阵,则画出带长度为 E(i,j)、 对称误差棒于曲面点(X(i,j),Y(i,j))之处

其实我还是没看懂,我是新手。这位仁兄能不能帮我编个具体例子的代码啊!谢谢你啦

[ 发自小木虫客户端 ]
4楼2014-02-11 01:00:09
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 7 个回答

bucheron

金虫 (小有名气)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★
感谢参与,应助指数 +1
lzht1986: 金币+10 2014-02-27 14:21:26
errorbar(X,Y,E) X,Y,E 必须为同型参量。若同为向量,则画出带长度为 2*E(i)、对 称误差棒于曲线点(X(i),Y(i))之处;若同为矩阵,则画出带长度为 E(i,j)、 对称误差棒于曲面点(X(i,j),Y(i,j))之处

» 本帖已获得的红花(最新10朵)

Born to suffer !Born to burn!
2楼2014-02-11 00:41:18
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

lzht1986

新虫 (小有名气)

送红花一朵
引用回帖:
2楼: Originally posted by bucheron at 2014-02-11 00:41:18
errorbar(X,Y,E) X,Y,E 必须为同型参量。若同为向量,则画出带长度为 2*E(i)、对 称误差棒于曲线点(X(i),Y(i))之处;若同为矩阵,则画出带长度为 E(i,j)、 对称误差棒于曲面点(X(i,j),Y(i,j))之处

谢谢你了,这么晚还回复辛苦你了。明早起来试试,谢谢啦

[ 发自小木虫客户端 ]
3楼2014-02-11 00:52:43
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

bucheron

金虫 (小有名气)

引用回帖:
4楼: Originally posted by lzht1986 at 2014-02-11 01:00:09
其实我还是没看懂,我是新手。这位仁兄能不能帮我编个具体例子的代码啊!谢谢你啦
...

试了一下,发现errorbar最多支持二维图像,重新弄了一下,可以支持三维的了,下边是一个例子,希望对你有帮助。

function Fcn_test
clear all
close all
clc

%------------------------
% one example of surface
[X,Y] = meshgrid(-2:.2:2, -2:.2:2);
Z = X .* exp(-X.^2 - Y.^2);  

%---------------------

eb_id=      [1,1;...
            17,6];  % errorbar index of X Y coordinates
        
x_eb_id=X(eb_id(:,1));  % X coordinates of the points with errorbars
y_eb_id=Y(eb_id(:,2));  % Y coordinates of the points with errorbars
for i=1:length(x_eb_id)
    z_eb_id(i)=Z(eb_id(i,2),eb_id(i,1));    % Z coordinates of the points with errorbars
end
eb_E=[0.2,0.2];                             % Error              

figure
surf(X,Y,Z)
hold on
plot3_errorbars_surf(x_eb_id,y_eb_id,z_eb_id,eb_E);

%-----------------------------------------------

function [h]=plot3_errorbars_surf(x, y, z, e)
% this matlab function plots 3d data using the plot3 function
% it adds vertical errorbars to each point symmetric around z
% I experimented a little with creating the standard horizontal hash
% tops the error bars in a 2d plot, but it creates a mess when you
% rotate the plot
%
% x = xaxis, y = yaxis, z = zaxis, e = error value

% create the standard 3d scatterplot
hold on;
h=plot3(x, y, z, '.k');

% looks better with large points
set(h, 'MarkerSize', 25);
hold on

% now draw the vertical errorbar for each point
for i=1:length(x)
        xV = [x(i); x(i)];
        yV = [y(i); y(i)];
        zMin = z(i) + e(i);
        zMax = z(i) - e(i);

        zV = [zMin, zMax];
        % draw vertical error bar
        h=plot3(xV, yV, zV, '-k');
        set(h, 'LineWidth', 2);
end
求教如何用MATLAB在三维图中插入各散点的误差条-1
res.jpg

» 本帖已获得的红花(最新10朵)

Born to suffer !Born to burn!
5楼2014-02-11 02:00:07
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
信息提示
请填处理意见