quarc_sine_scope_demo.mdl
Open this model

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

quarc_sine_scope_demo

QUARC Sine and Scope Demo

This is a simple yet important example that can be used to ensure correct operation of QUARC without requiring any special hardware such as a data acquisition card. A sine wave with amplitude 1 and frequency 1 rad/sec is generated and written directly to a scope where it can be traced:

Sine and Scope Demo Simulink diagram

Demonstration

Building, deploying and starting the model

Refer to One Step Process in QUARC Basic Procedures to build, deploy and start the model.

Running the model

Double click on the Scope block to open the Scope.

A sine wave of amplitude 1 will appear in the Scope as shown below. Notice that the Scope trace is moving in actual time. In other words, the trace passes the 10 second mark after 10 seconds have passed since QUARC runs the model in real-time on the QUARC target and communicate with Simulink via external mode communication.

Had you run the model in normal simulation (in which case you would not need to build any real-time code), the scope trace would move much faster than actual time. In normal simulation, Simulink runs the model as fast as possible with no relationship to actual time.

Scope with sine wave of amplitude 1

Double-click on the Signal Generator block. Change the Amplitude parameter from 1 to 5. Click OK to close the Signal Generator dialog box. The amplitude of the sine wave trace changes to 5 to reflect the new amplitude as shown below:

Scope with sine wave of amplitude 5

Stopping the model

Refer to One Step Process in QUARC Basic Procedures to stop the model.

Running the example on a different target

To run the example on a different target, refer to the instructions on the Running QUARC Examples on Remote Targets page.