Portfolio Optimization Examples
The following sequence of examples highlights features of the Portfolio object in the Financial Toolbox™. Specifically, the examples show how to set up mean-variance portfolio optimization problems that focus on the two-fund theorem, the impact of transaction costs and turnover constraints, how to obtain portfolios that maximize the Sharpe ratio,
Modeling the United States Economy
Economists and policymakers are concerned with understanding the dynamics of economies, especially during periods of significant macroeconomic shocks. Although numerous approaches are possible, we will develop a small macroeconomic model in the style of Smets and Wouters.
ANOVA with Random Effects
Use anovan to fit models where a factor's levels represent a random selection from a larger (infinite) set of possible levels.
Determine Minimum and Maximum Points and Add Text
Determine the minimum and maximum data points on a graph and add text descriptions next to these values.
Functional Derivatives Tutorial
Use functional derivatives in the Symbolic Math Toolbox™ using the example of the wave equation. The wave equation for a string fixed at its ends is solved using functional derivatives. A
You can display multiple plots in different subregions of the same window using the subplot function.
The function COLORNAMES matches the input RGB values or color name strings to the closest colors from the selected palette. COLORNAMES returns the same outputs whether matching names or
Codegen of Pack and Unpack Example
This example shows how to generate code from packData and unpackData
Pack and Unpack Data Example for MATLAB
Pack and unpack data using the provided packData and unpackData functions
Simulation of a Bouncing Ball
Use two different approaches to modeling a bouncing ball using Simulink®.
Single Hydraulic Cylinder Simulation
Use Simulink® to model a hydraulic cylinder. You can apply these concepts to applications where you need to model hydraulic behavior. See two related examples that use the same basic
Modeling a Fault-Tolerant Fuel Control System
Combine Stateflow® with Simulink® to efficiently model hybrid systems. This type of modeling is particularly useful for systems that have numerous possible operational modes based on
Anti-Windup Control Using a PID Controller
Use anti-windup schemes to prevent integration wind-up in PID controllers when the actuators are saturated. We use the PID Controller block in Simulink® which features two built-in