MATLAB Examples

This model shows how to model a digital potentiometer such as is used to control audio amplifiers from a digital circuit or microprocessor-controlled system. The model also shows how you can

A simple voltage regulator circuit constructed from discrete components. A fluctuating supply is modeled as 20V DC plus a 1V sinusoidal variation. The zener diode D1 sets the non-inverting

How a system-level model of a brushless DC motor (i.e. a servomotor) can be constructed and parameterized based on datasheet information. The motor and driver are modeled as a single masked

This model shows how a varistor may be applied to a buck converter in order to protect the switching MOSFETs from over-voltages due to a differential surge.

This model shows how a fault may be applied to a MOSFET in a power converter in order to explore the operation of protection circuitry. After the MOSFET becomes faulted, the crowbar circuitry

An electric vehicle model suitable for Hardware-In-the-Loop (HIL) deployment. Energy-based modeling is used to avoid high-frequency switching, and solvers set for fixed-step

A comparison of the torque-speed characteristics for five different motor types. To select the motor type, right-click on the Electric Motor block, select Variant->Override using and

A differential pair amplifier circuit. The circuit can be used to explore the properties of a differential pair amplifier. The model can be tested using differential and common-mode

Generation of the Ic versus Vce curve for an NPN bipolar transistor. Define the vector of base currents and minimum and maximum collector-emitter voltages by double clicking on the block

An implementation of a first order phase shifting filter. The filter is characterized by the transfer function H(s) = (sC - gm1)/(sC + gm1). Double-click on the Set Design Parameters block to

This model shows a class-E RF amplifier with circuit parameters chosen for an 80m wavelength. Class-E amplifiers achieve high efficiency levels as the MOSFETs never have simultaneously

This model shows how a flyback converter can step-up a 5V DC source into a 15V DC regulated supply. The voltage is increased by creating a time-varying voltage across a transformer primary.

A pulse-width-modulated (PWM) output implemented using a 555 Timer in astable mode. The duty cycle is set by a potentiometer, P1. The potentiometer is controlled during run-time via Duty

A detailed implementation model of a controlled linear actuator. The actuator consists of a DC motor driving a worm gear which in turn drives a lead screw to produce linear motion. The model

A Peltier device working in cooling mode with a hot side temperature of 50 degC. In cooling mode, the Coefficient of Performance (COP) of the Peltier cell is equal to the total heat transferred

Generation of the Ic versus Vce curve for an insulated gate bipolar transistor. Define the vector of gate-emitter voltages and minimum and maximum collector-emitter voltages by

An analog implementation of an anti-aliasing filter for use with an A-to-D converter. The filter cut-off frequency is set to 500Hz in order to match the A-to-D converter sampling frequency

A switching audio power amplifier circuit. Switching audio power amplifiers are more efficient than conventional power amplifiers as switching devices are operating only in the fully-on

A typical low-noise audio amplifier circuit. Resistor R2 provides negative feedback to stabilize the overall amplifier gain, making it independent of transistor open-loop forward

This model shows how the performance of a rotational energy scavenger can be explored using a simple representative model. Electrical energy is produced from an off-center mass attached to

Models the thermal dynamics of MOSFETs in a synchronous buck converter. It matches the structure of the Synchronous Buck Converter With Thermal Dynamics model (>>

An implementation of a fourth-order Sallen-Key low-pass filter using Operational Amplifiers (OPAs). The filter design parameters, cut-off frequency (f1) and DC gain (K), are specified

An implementation of a band-pass filter using three mutually-coupled inductors. The model can be used to validate filter parameters which are chosen to provide a band-pass centered on

Operation of a Kinetic Energy Recovery System (KERS) on a Formula 1 car. The model permits the benefits to be explored. During braking, energy is stored in a lithium-ion battery and

A limited travel solenoid with return spring. Magnetic hysteresis is modeled using the Reluctance with Hysteresis library block.

A simplified dynamic model of an automotive electrical system. The mode contains electrical, mechanical, and thermal systems, and is able to simulate the effect of engine starting on the

This model shows how to model a phase-locked loop. The charge pump and filter are modeled using discrete analog components whereas the oscillator is represented as behavioral component

This model shows how to use the Stepper Motor Driver and Stepper Motor blocks together to implement a controlled permanent magnet stepper motor. The model provides two controller options:

Test harness can be used to validate the 'Simplified I-V characteristics and event-based timing' variant of the Simscape™ Electrical™ N-Channel IGBT. This variant only requires I-V data

Generation of the characteristic curves for an N-channel MOSFET. Define the vector of gate voltages and minimum and maximum drain-source voltages by double clicking on the block labeled

Allows the user to explore the impact of parameter choices on the I-V and C-V characteristics for a surface-potential-based thermal MOSFET model. To open this example, in the MATLAB®

An implementation of a Colpitts oscillator circuit with a nominal frequency of 9MHz. The frequency of oscillation is given by 1/(2*pi*sqrt(L1*C1*C2/(C1+C2))). LC oscillators have good

Model a custom transformer that exhibits hysteresis by using the Reluctance with Hysteresis block in a magnetic circuit. The transformer is rated for a 50W load and steps down from 120V to 12V

Validation of the dynamic behavior of the Thyristor block against its mask values. Mask values are closely related to datasheet values, and the Thyristor block uses these values to

This model shows how to develop a model of an uncontrolled linear actuator using datasheet parameter values. The actuator consists of a DC motor driving a 6.25:1 worm gear which in turn drives

A hybrid actuator consisting of a DC motor plus lead screw in series with a piezoelectric stack. The DC motor and lead screw combination supports large displacements (tens of millimeters),

A nonlinear model of a PMSM with thermal dependency. The PMSM behavior is defined by tabulated nonlinear flux linkage data. Motor losses are turned into heat in the stator winding and rotor

Allows the user to explore the impact of parameter choices on the I-V and C-V characteristics for a surface-potential-based MOSFET model. To open this example, in the MATLAB® Command

A Class E power converter with frequency control. A simple integral control is implemented in Simulink® in the Controller block, and is designed to deliver 100W into a 5ohm load. The switch is

Model a switching power supply that converts a 30V DC supply into a regulated 15V DC supply. The model can be used to both size the inductance L and smoothing capacitor C, as well as to design the

This model shows how to use the Unipolar Stepper Motor Driver and Unipolar Stepper Motor blocks together to implement a controlled permanent magnet stepper motor. The model provides two

A DC-DC LLC power converter with frequency control. A simple integral control is implemented in Simulink® in the Controller block, and is designed to achieve a nominal output voltage

An implementation of a triangle wave generator circuit using two op-amps. The first stage of the circuit is a comparator constructed from an op-amp. The output of the comparator is limited to

An audio amplifier circuit based on an N-channel JFET. The desired operating point is taken to be Vds=5V, Id=2mA and Vgs=-2V. The manufacturer datasheet gives the JFET forward transfer

Generate the power-voltage curve for a solar array. Understanding the power-voltage curve is important for inverter design. Ideally the solar array would always be operating at peak power

How a sigma-delta ADC (analog to digital converter) uses sigma-delta modulation to convert an analog input signal into a digital output signal. The analog input to the sigma-delta ADC

Model a J-K flip-flop from Simscape™ Electrical™ logic components. With the two switches in their default positions, both inputs to the flip-flop are set high so its output state toggles

A communication link that follows the ARINC 429 specification. Here it is configured for 100kBits per second operation. The ARINC 429 specification is for a simplex broadcast bus with odd

Model a second-order active low-pass filter. The filter is characterized by the transfer function H(s) = 1 / ( (s/w1)^2 + (1/Q)*(s/w1) + 1 ) where w1 = 2*pi*f1, f1 is the cut-off frequency and Q

A limited travel solenoid with return spring. When unpowered, the spring holds the plunger at a distance of 0.1mm from the fully energized position. At 0.1 seconds, the solenoid is powered on

A low-cost voltage regulator circuit whose performance depends on both load current and temperature. Bias resistor R1 ensures that the voltage at the transistor base is close to the rated

How modifying the equation coefficients of the Jiles-Atherton magnetic hysteresis equations affects the resulting B-H curve. The simulation parameters are configured to run four

Validation of the static behavior of the Thyristor block against its mask values. Mask values are closely related to datasheet values, and the thyristor block uses these values to calculate

How alternator behavior can be abstracted to a DC model that simulates efficiently. This test harness first ramps the alternator speed linearly from zero to a typical idle speed of 900 RPM.

A LED driver based on a linear current regulator. The scope shows the light and current output and the supply voltage. The output comes into regulation for a supply voltage greater than about

Generation of the current versus voltage curve for a Schottky barrier diode. Define the vector of temperatures for which to plot the characteristics by double clicking on the block labeled

The generation of I-V and C-V characteristics for an NMOS transistor. Define the bias conditions for the gate-source and drain- source voltage sweeps and the types of plots to be generated by

A test harness for a Permanent Magnet Synchronous Motor (PMSM) drive sized for use in a typical hybrid vehicle. The test harness can be used to determine overall drive losses when operating at

A simplified AM radio receiver. A single tone signal at 2kHz is transmitted with a carrier frequency of 600kHz. The variable capacitor, Cres, in the resonant circuit is used in order to sweep

A comparison of nonlinear inductor behavior for different parameterizations. Starting with fundamental parameter values, the parameters for linear and nonlinear representations are

Create system-level model of a photovoltaic generator that can be used to simulate performance using historical irradiance data. Here the model is tested by varying the irradiance which

How noise can be incorporated into an electrical simulation. The circuit models an amplifier with gain 100 and a high-frequency roll off frequency of 10MHz. The op-amp adds noise, and it is

The basic architecture of a power-split hybrid transmission. The planetary gear, along with the motor and generator, acts like a variable ratio gear. In this test, the vehicle accelerates

An H-bridge configuration switching audio power amplifier circuit. Switching audio power amplifiers are more efficient than conventional power amplifiers as switching devices are

Allows the user to explore the impact of parameter choices on the I-V and C-V characteristics for a surface-potential-based p-channel LDMOS field-effect transistor model. To open this

Use Simscape™ Electrical™ detailed switching device models to create tabulated switching loss data. This tabulated data can then be used with the piecewise linear switching device

How manufacturer data for torque as a function of current and angle can be used to model a torque motor. The datasheet shows linear characteristics for rotor angles between 20 and 70 degrees

Generation of the Ic versus Vce curve for a PNP bipolar transistor. Define the vector of base currents and minimum and maximum collector-emitter voltages by double clicking on the block

This model shows the Unipolar Stepper Motor simulating in Stepping and Averaged simulation modes. The purpose of Averaged mode is faster simulation for any loads that do not cause slip. To

A test harness for a Permanent Magnet Synchronous Motor (PMSM) that validates that the iron losses are as expected. The open-circuit test validates the main flux path losses which are

Determine the efficiency of a single-stage solar converter. The model simulates one complete AC cycle for a specified level of solar irradiance and corresponding optimal DC voltage and AC

Model the interface between a microcontroller unit (MCU) and a physical system. Here the microcontroller's GPIO, ADC and DAC connections are used to control a DC motor and connected load

This model shows how to parameterize the Simscape™ Electrical™ diode to represent a Transient Voltage Suppression (TVS) diode. This example is for a TVS diode suited to protecting

This model shows how a diode ring can be used to demodulate a frequency-modulated signal. The RF input has a fixed frequency of 9MHz, and the local oscillator has a fixed frequency of 11MHz.

Calculation and confirmation of a nonlinear transformer core magnetization characteristic. Starting with fundamental parameter values, the core characteristic is derived. This is

Optimization of the Solar Cell block's parameters to fit data defined over a range of different temperatures. It uses the MATLAB® optimization function fminsearch. Other products

This model shows how to model a strain gauge and measurement amplifier. The strain gauge forms one leg of a Wheatstone bridge, which is connected to a differential amplifier. A second op-amp

Import a motor design from ANSYS® Maxwell® into a Simscape™ simulation.

This model shows a transmission line model and bi-directional test bridge. Reflected and transmitted signals are slightly different if the test direction is changed. This is because the

Model and assess the impact of component tolerances and fault events on the operation of a switching power supply. The R, L, and C components all have tolerances, operational limits, and

A buck converter configured for a measurement of common- and differential-mode noise on the source. In order to simulate the common-mode noise, the capacitive coupling between the circuit

This model shows a voltage-controlled oscillator with feedback control to regulate the output voltage. The oscillation frequency is controlled by the reverse bias voltage applied to the

An implementation of an astable oscillator circuit. The circuit output voltage V2 oscillates in an unstable fashion between high and low states.

This model shows how the Multiplier block can be used to multiply or divide two input voltages. In both cases, slew rate limiting occurs until the final voltage is reached. Note that the

How a DC-DC converter can be used to maintain a constant load voltage when drawing power from an ultracapacitor. Initially the converter supplies power to the load, and as it does so, the

How the dynamic characteristics of an IGBT depend on its parameters. A prerequisite to matching dynamic characteristics to datasheet values or measured data is to set the parameters

This model shows how fundamental thermal, mechanical and electrical components can be used to model a thermistor-controlled fan. The heat-generating device starts producing 2 watts at

This model shows the Stepper Motor simulating in Stepping and Averaged simulation modes. The purpose of Averaged mode is faster simulation for any loads that do not cause slip. To avoid

Two ways to create a model of an integrated circuit that can be used in conjunction with other Simscape™ Electrical™ blocks. The first approach is to build a behavioral model using Simscape

Generation of the Ic versus Vce curve for an IGBT at two different temperatures. To generate the plot, click on the hyperlink in the model labeled 'Plot IGBT curves'.

This model shows how to use the Controlled PWM Voltage and H-Bridge blocks to control a motor. The DC Motor block uses manufacturer datasheet parameters, which specify the motor as

Build a model of a Switched Reluctance Motor (SRM). A custom Simscape™ composite component is used to construct the three stator pole pairs using the Simscape Electrical™

A simple implementation of a sigma delta analog-to-digital converter. Inputs in the range 0 to Vref (=1V) are integrated and then reset, the time of integration as a proportion of the total

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Contact your local office