N = 1 ;
x = 100*rand(20,1);
y = 100*rand(20,1);
ln_x = log(x) ;
ln_y = log(y) ;
fit_ln_xy = fitlm( ln_x, ln_y ) ;
p = polyfit( ln_x, ln_y , 1) ;
y_fit = polyval( p , ln_x );
loglog( x , y , '*' )
hold on
loglog( x , exp(y_fit) , 'k' , 'linewidth', 1.5)
loglog( x , exp(y_fit + N*fit_ln_xy.RMSE ) , 'b--' , 'linewidth', 1.2)
loglog( x , exp(y_fit - N*fit_ln_xy.RMSE ) , 'r--' , 'linewidth', 1.2)
legend('Original data ' , 'linear fit' , 'linear fit + 1 std' , 'linear fit - 1 std')
0 Comments
Sign in to comment.