error bar in two plot3 and how to show error of figures?

조회 수: 4 (최근 30일)
Myo Gyi
Myo Gyi 2018년 10월 15일
댓글: Star Strider 2018년 10월 16일
if true
% coade
end
r0=10.0;
z0=1.0;

채택된 답변

Star Strider
Star Strider 2018년 10월 16일
You only have two curves so statistics (such as the standard deviation) are meaningless, and (to the best of my knowledge), errorbar is not defined for 3D plots. Fortunately, you have the same number of elements in each vector of your two plots, so a one-to-one correspondence is possible.
This ‘connects’ the two corresponding elements in each of your vectors in a 3D plot. The red dotted line is the mean of the corresponding points. It is not an errorbar plot (for the reason I just stated), but it may be what you want:
r0=10.0;
z0=1.0;
a=0.1;
nu=1.3;
Gamm_inf=1000;
t=(0:0.05:10)';
z=z0*exp(2*a*t);
r=r0*exp(-a*t);
w=a*r.^2/(2*nu);
w0=a*r0^2/(2*nu);
theta=-Gamm_inf/(8*pi*nu)*((1./w.*(1-exp(-w))-1/w0*(1-exp(-w0)))-expint(w)-expint(w0));
[x1, y1]=pol2cart(theta,r);
plot3(x1,y1,z)
hold on
% function main
%Set initial values for r, theta, z
r00 = 10;
theta00 = 0;
z00 = 1.0;
y0 = [r00 theta00 z00];
% Set model parameters
z0 = 0.0;
a = 0.1;
gamma_inf = 1000.0;
nu = 1.0;
% Set integration period
tspan = 0:0.05:10;
% Call integrator
fun = @(t,y)[-a*y(1);gamma_inf/(2*pi*y(1)^2)*(1-exp(-a*y(1)^2/(2*nu)));2*a*(y(3)-z0)];
[T Y] = ode45(fun,tspan,y0);
R = Y(:,1);
THETA = Y(:,2);
Z = Y(:,3);
% Convert polar to cartesian coordinates
[x2, y2] = pol2cart(THETA,R);
% Plot spiral
plot3(x2,y2,Z, '--')
hold off
grid on
xm = mean([x1 x2],2);
ym = mean([y1 y2],2);
zm = mean([z Z],2);
figure
plot3([x1 x2]', [y1 y2]', [z Z]', '-', 'Color',[0.5 0.5 0.5])
hold on
plot3(xm, ym, zm, '.-r')
hold off
grid on
view(25, 15)
xlabel('dx')
ylabel('dy')
zlabel('dz')
producing:
This is my best (and only) effort. I leave any other explorations to you.
Experiment to get the result you want.
  댓글 수: 2
Myo Gyi
Myo Gyi 2018년 10월 16일
Thank you very much sir..
Star Strider
Star Strider 2018년 10월 16일
As always, my pleasure.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Errorbars에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by