summaryrefslogtreecommitdiff
path: root/modules/randlib/demos/weibull.dem.sce
blob: 335881e0100a70dcb5aae90801f6df492fb62d32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) ENPC
// Copyright (C) ????-2008 - INRIA
// Copyright (C) 2010 - DIGITEO - Allan CORNET
//
// This file is released under the 3-clause BSD license. See COPYING-BSD.


function [] = WeibullT(n)

    function [y] = Weibull(m, n, Alpha, Beta)
        //-------------------------------
        y = rand(m, n, "uniform");
        y = (Beta*( - log(1-y))).^(1/Alpha);
    endfunction

    [lhs, rhs] = argn(0);
    if rhs <= 0 ; n = 10000;end
    y = Weibull(1, n, 1, 2);

    drawlater();
    my_handle = scf(100001);
    clf(my_handle, "reset");
    demo_viewCode("weibull.dem.sce");
    histplot(20, y, [1,1], "061");
    xtitle(_("Simulation of a Weibull random variable"));
    BackgroundColorId = color(232,230,200);
    PolylineFillColorId = color(179,179,0);
    current_axe = gca();
    current_axe.title.font_size = 3;
    current_axe.background = color(232,230,200);
    current_axe.children.children.fill_mode = "on";
    current_axe.children.children.background = PolylineFillColorId;
    current_axe.grid = [-1 PolylineFillColorId];
    drawnow();

endfunction

WeibullT();
clear WeibullT;