Hello Rahul,
From what I can understand, you can do the following as an alternative to using MATLAB script
1. There can be two ways Define the transport delay function (td1)
1.1. Using your regular Simulink blocks. Define the “frequency” of the sine wave input source as 40*pi. Run this model before the other and save the output to the workspace as td1. You can mask this as a subsystem and make it priority 1 while compiling. This way it will store the value of td1 to the workspace before it executes the transfer function.
1.2. Define the td1 value in the “Initialization Function” subsection of the “Model Properties” dialog box.
2. After completing step 1, convert the exponential transfer function to a logical format using the Transfer Function from the Simulink/Continuous library.
2.1. In the transfer function you can convert your exponential function exp^(-td1*s) to exp^(-td1*s/2)/ exp^(td1*s/2).
2.2. This can then be simplified down to (1+(td1*s)/2)/( 1-(td1*s)/2)
3. Give the input to this transfer function as a constant (1) and the output is what you desired.