source: mso/sample/miscellaneous/sample_if_tanh.mso @ 1

Last change on this file since 1 was 1, checked in by Rafael de Pelegrini Soares, 16 years ago

Initial import of the library

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 916 bytes
Line 
1#*---------------------------------------------------------------------
2* This file is property of the author and cannot be used, copyed
3* or modified without permission.
4*
5* Copyright (C) 2002-2005  the author
6*----------------------------------------------------------------------
7* Author: Paula Bettio Staudt and Rafael de Pelegrini Soares
8* $Id: sample_if_tanh.mso 1 2006-06-20 17:33:53Z rafael $
9*----------------------------------------------------------------------
10*
11* EMSO sample file.
12*
13* FlowSheet showing how to 'emulate' an 'if' conditional with
14* hyperbolic functions.
15*
16*-------------------------------------------------------------------*#
17
18FlowSheet SampleIF
19        VARIABLES
20        A; xif; xelse;
21       
22        PARAMETERS
23        B as Real(Default = 10);
24       
25        EQUATIONS
26        #* if (time>3)
27        *     A = 10;
28        *  else
29        *     A = 5;
30        *#
31        A = 10*xif + 5*xelse;
32
33        xif = (1 + tanh(B * (time - 3)))/2;
34        xelse = (1 - tanh(B * (time - 3)))/2;
35       
36        SET
37        B = 100;
38       
39        OPTIONS
40        time = [0:0.01:6];
41end
Note: See TracBrowser for help on using the repository browser.