Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

db_0117: Simulink patterns for vector signals

ID: Title

db_0117: Simulink® patterns for vector signals

Priority

Strongly recommended

Scope

MAAB

MATLAB Versions

All

Prerequisites

None

Description

Simulink is a vectorizable modeling language allowing for the direct processing of vector data. Use the following patterns for vector signals within a Simulink model:

Equivalent FunctionalitySimulink Pattern

Vector loop

for (i=0; 
i<input_vector_size; i++) 
{ 
output_vector(i) = 
input_vector(i) * 
tunable_parameter_value; 
}

Vector loop

for (i=0; 
i<input_vector_size; i++) 
{  
output_vector(i) = 
input_vector(i) * 
tunable_parameter_vector(i); 
}

Vector loop

output_signal = 1; 
for (i=0; 
i<input_vector_size; i++) 
{ 
output_signal = 
output_signal * 
input_vector(i); 
} 

Vector loop

output_signal = 1;  
for (i=0; 
i<input_vector_size; i++) 
{ 
output_signal = 
output_signal / 
input_vector(i); 
} 

Vector loop

for (i=0; 
i<input_vector_size; i++) 
{
output_vector(i) = 
input_vector(i) + 
tunable_parameter_value; 
}

Vector loop

for (i=0; 
i<input_vector_size; i++) 
{  
output_vector(i) = 
input_vector(i) + 
tunable_parameter_vector(i);  
} 

Vector loop:

output_signal = 0;  
for (i=0; 
i<input_vector_size; i++) 
{ 
output_signal = 
output_signal + 
input_vector(i);  
} 

Vector loop:

output_signal = 0;  
for (i=0; 
i<input_vector_size; i++) 
{ 
output_signal = 
output_signal - 
input_vector(i);  
} 

Minimum or maximum of a signal or a vector over time:

Change event of a signal or a vector:

Rationale

  • Readability

  • Verification and Validation

  • Code Generation

Last Changed

V2.2

Model Advisor Check

Not applicable

Introduced in R2010a

Was this topic helpful?