matlab画拟合直方图的脚本

都是一些简单的作图参数,可以自己按照matlab官方的指导去改style

https://ww2.mathworks.cn/help/stats/histfit.html

matlab画拟合直方图的脚本_第1张图片

%-----------------------------------------------------------------------------------------------------------%
%-----Function: Plot a histogram with fitting curve
%-----Input:
%                     Deformation rate (mm/y) or Fitting accuracy (mm/y)
%                     
%-----Output:
%                     a figure of histfit
%                     
%                     
%                     
%                     
%                     
%-----Author: Xieweiguo [email protected] (JXNU, 
%             School of Geography and Environment)
%
% CSDN Blog: https://blog.csdn.net/qq_41159191?type=blog
%
%-----Update Date: 20230705 v1
%-----------------------------------------------------------------------------------------------------------%

% 
close all
clear
clc
% 

%
% load data,whatever how many array 
% when load n arrays,you can plot n figures
% 
load ./deformationRate.mat
load ./fittingAccuracy.mat

def = deformationRate;
acc = fittingAccuracy;


% fig of Deformation rate (mm/y)
figure( 1 ); 
h = histfit(def,100); 
legend({'Statistical','Fitted curve'},'Location','southwest')
xlabel('Deformation rate (mm/y)')
ylabel('Point Number')
xlim ([-50, 20]);
h(1).FaceColor = "y";




% fig of Fitting accuracy (mm/y)
figure( 2 );
h2 = histfit(acc,100);
legend({'Statistical','Fitted curve'},'Location','southwest')
xlabel('Fitting accuracy (mm/y)')
ylabel('Point Number')
xlim ([0, 1]);
h2(1).FaceColor = "y";

你可能感兴趣的:(matlab,开发语言)