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

2 views (last 30 days)
if true
% coade
end
r0=10.0;
z0=1.0;

Accepted Answer

Star Strider
Star Strider on 16 Oct 2018
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.

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!