
There are times when you want certain parts of your program to beĮxecuted only in limited circumstances. Greater than 3 the eigen values of the inverse of the matrix are foundĪnd plotted, otherwise, the system is inverted to find anĪpproximation to y’=sin(x) according to the specified boundary If this variable is less than 3, theįile will find and plot the eigen values of the matrix, if it is The file is called by Matlab, and it constructs a second derivativeįinite difference matrix with boundary conditions.


Here we will define an executable file that contains an if statement. Rate of change is discontinuous, you may want to change the rate ForĮxample, if you are approximating a differential equation, and the There are times when you want your code to make a decision. ( Plotting), executable files ( Executable Files), or ( Vector Functions), loops ( Loops), plotting ( Introduction to Vectors in Matlab), matrices ( Introduction to Matrices in Matlab), vector operations More information on those topics see one of our tutorials on vectors

In each case, the output is biased by +2.In this tutorial we will assume that you know how to create vectorsĪnd matrices, know how to index into them, and know about loops. When the pulse is off, the output is the clipped version of the sine wave. When the pulse is on, the output is the absolute value of the sine wave. The scope shows the sine wave input, the triggering pulse input, and the merged and biased output. The outputs of the two subsystems are never active at the same time and are merged into one signal with a Saturation block. If the input to the If block is not positive, as specified by the else condition, then the If Action Subystem Saturation between -0.75 and 0.75 is activated, which outputs a clipped version of the sine wave signal using a Saturation block.

If the input is positive, as specified by the if condition, then the If Action Subsytem Abs is activated, which outputs the absolute value of the sine wave input signal. It is designed to illustrate the similarity between the If Action Subsystem block and the Enabled Subsystem block.Ī pulse generator is connected to an If block, which compares the input to zero. This example shows the effect of feeding a sine wave into If Action Subsystem blocks.
