Version [91344]
Dies ist eine alte Version von Plots erstellt von Christian am 2018-09-24 14:17:26.
Einfache verschiedene Grundplots
Liniendiagramm
x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y)
x = linspace(-2*pi,2*pi);
y1 = sin(x);
y2 = cos(x);
plot(x,y1,x,y2)
x = 0:pi/100:2*pi;
y1 = sin(x);
y2 = sin(x-0.25);
y3 = sin(x-0.5);
plot(x,y1,x,y2,'--',x,y3,':')
Säulendiagramm
y = [10 15 20 30 22];
bar(y)
x = 1900:10:2000;
y = [10 15 20 30 22];
bar(x,y)
y = [10 15 20 30 22];
bar(y,0.5)
y = [1 2 3; 4 5 6; 7 8 9; 10 11 12];
bar(y)
y = [1 5 9; 2 6 10; 3 7 11; 4 8 12];
bar(y,'stacked')
Balkendiagramm
y = [10 15 20 30 22];
barh(y)
x = 1900:10:2000;
y = [10 15 20 30 22];
barh(x,y)
y = [10 15 20 30 22];
barh(y,0.5)
y = [1 2 3; 4 5 6; 7 8 9; 10 11 12];
barh(y)
y = [1 5 9; 2 6 10; 3 7 11; 4 8 12];
barh(y,'stacked')
Histogramm
x = randn(500,1);
histogram(x)
x = randn(500,1);
nbins = 25;
histogram(x,nbins)
Histogramm - 3D
x = randn(500,1);
y = randn(500,1);
histogram2(x,y)
x = randn (1000,1);
y = randn (1000,1);
nbins = 5;
histogramm2 (x, y, nbins)
Kuchendiagramm
X = [1 2 3 4 5];
pie(X)
X = [1 2 3 4 5];
explode = [0 1 0 1 0]; bei 1 ist das Kuchenstück herausgenommen
pie(X,explode)
X = [1 2 3 4 5];
labels = {'PIE 1', 'PIE 2', 'PIE 3', 'PIE 4', 'PIE 5'};
pie(X,labels)
Kuchendiagramm - 3D
X = [1 2 3 4 5];
pie3(X)
X = [1 2 3 4 5];
explode = [0 1 0 1 0]; bei 1 ist das Kuchenstück herausgenommen
pie3(X,explode)
X = [1 2 3 4 5];
labels = {'PIE 1', 'PIE 2', 'PIE 3', 'PIE 4', 'PIE 5'};
pie3(X,labels)
Streudiagramm
x = linspace(0,3*pi,200);
y = sin(x) + rand(1,200);
scatter(x,y)
x = linspace(0,3*pi,200);
y = sin(x) + rand(1,200);
sz = linspace(1,100,200);
scatter(x,y,sz)
x = linspace(0,3*pi,200);
y = sin(x) + rand(1,200);
c = linspace(1,10,length(x));
scatter(x,y,[],c)
Streudiagramm - 3D
[X,Y,Z] = sphere(16);
x = [0.5*X(:); 0.75*X(:); X(:)];
y = [0.5*Y(:); 0.75*Y(:); Y(:)];
z = [0.5*Z(:); 0.75*Z(:); Z(:)];
scatter3(x,y,z)
[X,Y,Z] = sphere(16);
x = [0.5*X(:); 0.75*X(:); X(:)];
y = [0.5*Y(:); 0.75*Y(:); Y(:)];
z = [0.5*Z(:); 0.75*Z(:); Z(:)];
S = repmat([100,50,5],numel(X),1);
s = S(:);
scatter3(x,y,z,s)
view(40,35)
[X,Y,Z] = sphere(16);
x = [0.5*X(:); 0.75*X(:); X(:)];
y = [0.5*Y(:); 0.75*Y(:); Y(:)];
z = [0.5*Z(:); 0.75*Z(:); Z(:)];
S = repmat([50,25,10],numel(X),1);
C = repmat([1,2,3],numel(X),1);
s = S(:);
c = C(:);
scatter3(x,y,z,s,c)
view(40,35)
Oberflächendiagramm
[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
surf(X,Y,Z)
[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
C = X.*Y;
surf(X,Y,Z,C)
colorbar
Netzdiagramm
[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
mesh(X,Y,Z)
[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin( R)./R;
C = gradient(Z);
mesh(X,Y,Z,C)
Erweiterte/Spezifische Plots
Die Daten für dieses Beispiel sind Bewegungsdaten von einem Balance Board.