R=5;C=1;
dat = rand(50,1);
subplot(R,C,1);
plot(dat)
m = mean(dat);
ax = gca;
xlimits = ax.XLim;
h = line([xlimits(1),xlimits(2)],[m,m],'Color','k','LineStyle','--');
legend(h,'mean of data');
subplot(R,C,2);
g1 = hggroup;
g2 = hggroup;
t = linspace(0,2*pi,100);
plot(t,sin(t),'b','Parent',g1)
hold on
plot(t,sin(t+1/7),'b','Parent',g1)
plot(t,sin(t+2/7),'b','Parent',g1)
plot(t,sin(t+3/7),'b','Parent',g1)
plot(t,cos(t),'g','Parent',g2)
plot(t,cos(t+1/7),'g','Parent',g2)
plot(t,cos(t+2/7),'g','Parent',g2)
plot(t,cos(t+3/7),'g','Parent',g2)
hold off % reset hold state to off
legend([g1,g2],'sine','cosine')
subplot(R,C,3);
x = linspace(0,2*pi,100);
y1 = sin(x);
p1 = plot(x,y1,'DisplayName','sin(x)');
hold on
y2 = sin(x) + pi/2;
p2 = plot(x,y2,'DisplayName','sin(x) + \pi/2');
y3 = sin(x) + pi;
p3 = plot(x,y3,'DisplayName','sin(x) + \pi');
hold off
legend([p1 p2 p3])
subplot(R,C,4);
t = linspace(0,2*pi,50);
y = sin(t);
plot(t,y);
x1 = pi;
y1 = sin(pi);
str1 = '\leftarrow sin(\pi) = 0';
text(x1,y1,str1);
x2 = 3*pi/4;
y2 = sin(3*pi/4);
str2 = '\leftarrow sin(3\pi/4) = 0.71';
text(x2,y2,str2)
x3 = 5*pi/4;
y3 = sin(5*pi/4);
str3 = 'sin(5\pi/4) = -0.71 \rightarrow';
text(x3,y3,str3,'HorizontalAlignment','right');
subplot(R,C,5);
x = linspace(-3,3);
y = (x/5-x.^3).*exp(-2*x.^2);
plot(x,y);
indexmin = find(min(y) == y);
xmin = x(indexmin);
ymin = y(indexmin);
indexmax = find(max(y) == y);
xmax = x(indexmax);
ymax = y(indexmax);
strmin = ['Minimum = ',num2str(ymin)];
text(xmin,ymin,strmin,'HorizontalAlignment','left');
strmax = ['Maximum = ',num2str(ymax)];
text(xmax,ymax,strmax,'HorizontalAlignment','right');
dat = rand(50,1);
subplot(R,C,1);
plot(dat)
m = mean(dat);
ax = gca;
xlimits = ax.XLim;
h = line([xlimits(1),xlimits(2)],[m,m],'Color','k','LineStyle','--');
legend(h,'mean of data');
subplot(R,C,2);
g1 = hggroup;
g2 = hggroup;
t = linspace(0,2*pi,100);
plot(t,sin(t),'b','Parent',g1)
hold on
plot(t,sin(t+1/7),'b','Parent',g1)
plot(t,sin(t+2/7),'b','Parent',g1)
plot(t,sin(t+3/7),'b','Parent',g1)
plot(t,cos(t),'g','Parent',g2)
plot(t,cos(t+1/7),'g','Parent',g2)
plot(t,cos(t+2/7),'g','Parent',g2)
plot(t,cos(t+3/7),'g','Parent',g2)
hold off % reset hold state to off
legend([g1,g2],'sine','cosine')
subplot(R,C,3);
x = linspace(0,2*pi,100);
y1 = sin(x);
p1 = plot(x,y1,'DisplayName','sin(x)');
hold on
y2 = sin(x) + pi/2;
p2 = plot(x,y2,'DisplayName','sin(x) + \pi/2');
y3 = sin(x) + pi;
p3 = plot(x,y3,'DisplayName','sin(x) + \pi');
hold off
legend([p1 p2 p3])
subplot(R,C,4);
t = linspace(0,2*pi,50);
y = sin(t);
plot(t,y);
x1 = pi;
y1 = sin(pi);
str1 = '\leftarrow sin(\pi) = 0';
text(x1,y1,str1);
x2 = 3*pi/4;
y2 = sin(3*pi/4);
str2 = '\leftarrow sin(3\pi/4) = 0.71';
text(x2,y2,str2)
x3 = 5*pi/4;
y3 = sin(5*pi/4);
str3 = 'sin(5\pi/4) = -0.71 \rightarrow';
text(x3,y3,str3,'HorizontalAlignment','right');
subplot(R,C,5);
x = linspace(-3,3);
y = (x/5-x.^3).*exp(-2*x.^2);
plot(x,y);
indexmin = find(min(y) == y);
xmin = x(indexmin);
ymin = y(indexmin);
indexmax = find(max(y) == y);
xmax = x(indexmax);
ymax = y(indexmax);
strmin = ['Minimum = ',num2str(ymin)];
text(xmin,ymin,strmin,'HorizontalAlignment','left');
strmax = ['Maximum = ',num2str(ymax)];
text(xmax,ymax,strmax,'HorizontalAlignment','right');
Комментариев нет:
Отправить комментарий