Why is my script not publishing the figure?
152 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Greetings guys!
I don't understand why, when I publish this script, the figure (plot and histogram) isn't being published along with the code.
The code is the following:
%% BETA DISTRIBUTION HOMEWORK
clear;
clc;
% "Subordinated" Bonds:
mu = 0.35;
sigma = 0.25;
%% Ex. 1
X = 0:0.00001:1;
Y = betapdf(X,a(mu,sigma),b(mu,sigma));
%% Ex. 2
R = betarnd(a(mu,sigma),b(mu,sigma),1,10000);
figure
subplot(2,1,1)
plot(X,Y)
title('Beta densities consistent with empirical \mu = 35% and \sigma = 25%','fontsize',12)
xlabel('Recovery rate','fontsize',10)
subplot(2,1,2)
hist (R)
title('Histogram','fontsize',14)
xlabel('Recovery rate','fontsize',10)
%% Functions
function a_par = a(mu,sigma)
a_par = mu*(mu*(1-mu)/sigma^2 - 1);
end
function b_par = b(mu,sigma)
b_par = (1-mu)*(mu*(1-mu)/sigma^2 - 1);
end
0 Kommentare
Antworten (1)
Nagini Venkata Krishna Kumari Palem
am 30 Mär. 2017
I understand that you wish to display figures in your published document. MATLAB has 'snapnow' command which forces the snapshot to be included in published document. All you need to do is add the 'snapnow' command after plotting figure. For example, in your case,
hist (R)
title('Histogram','fontsize',14)
xlabel('Recovery rate','fontsize',10)
snapnow
2 Kommentare
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!