Why is my script not publishing the figure?

161 visualizaciones (últimos 30 días)
David Lopes
David Lopes el 28 de Mzo. de 2017
Comentada: Samuel Abimbola Ogunfuye el 20 de Jun. de 2019
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

Respuestas (1)

Nagini Venkata Krishna Kumari Palem
Nagini Venkata Krishna Kumari Palem el 30 de Mzo. de 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
For more information you can take a look at the following documentation snapnow
  2 comentarios
Samuel Abimbola Ogunfuye
Samuel Abimbola Ogunfuye el 20 de Jun. de 2019
Great .. it works perfectly.. Appreciate it.. Thanks a lot

Iniciar sesión para comentar.

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by