METLAP plot

 

buka mathlab : https://matlab.mathworks.com/?trial=true&elqsid=1610875083014&potential_use=Student

Ref :  http://www.ece.northwestern.edu/local-apps/matlabhelp/techdoc/ref/bar.html

Generate a bell-curve histogram from Gaussian data.

  • x = -2.9:0.1:2.9;
    y = randn(10000,1);
    hist(y,x) 

Change the color of the graph so that the bins are red and the edges of the bins are white.

  • h = findobj(gca,'Type','patch');
    set(h,'FaceColor','r','EdgeColor','w')


  • Plot a bell shaped curve:

    • x = -2.9:0.2:2.9;
      bar(x,exp(-x.*x))
      colormap hsv

    • -------------------------------------
    • buat Plot
    • clear
      clc
      x=linspace(-2,2);
      y=x.^2-1;
      plot(x,y);



    • ------------------------------------------------------

    • clear
      x = randn(1,1000);
      % Do a histogram to plot.
      % First get the height of the bars.
      [N1,X1] = hist(x,15);
      y=zeros(numel(x));
      acc=0.4*max(x);
      y=x(x>acc);
      [N2,X2] = hist(y,round(15*0.3));
      % Use the bar function to plot.
      bar(X1,N1,1,'w')
      xlim([-4 4])
      ylim([0 max(N1)])
      %plot(2,1,2)
      figure
      bar(X2,N2,1,'w')
      xlim([-4 4])
      ylim([0 max(N1)])
      title('Histogram of Uniform Random Variables')
      xlabel('X')
      ylabel('Frequency')






---------------------------------------
buat data covid smp 6 bulan
 
y = [
105597
104847
104235
103522
102678
101897
100991
100220
99158
98206
97217



76619 7552 ];
bar(y)

title('Histogram of Covid 19 Oktober')
xlabel('X')
ylabel('Frequency')
 
 
y = [75 91 105 123.5 131 150 179 203 226 249 281.5];
bar(y,'FaceColor',[0 .5 .5],'EdgeColor',[0 .9 .9],'LineWidth',1.5)


 subplot(2,2,1)
 subplot(2,2,2)
subplot(2,2,4)
y2 = [
80320 2222 ];
title('Histogram of Covid 19 ')  
xlabel('Agustus')ylabel('Frequency') 

 
 

-----------------------------

hist

Histogram plot

Syntax

Comments