Matlab Simulink

A quick summary of Matlab Simulink

Matlab is a programming language that is often used in engineering applications. This tutorial will teach you how to setup Matlab and Solidworks to run simulations on Solidworks assemblies.


This tutorial assumes you have Solidworks downloaded and you download Matlab with all the extensions such as Simulink. If you used a license given by UAS, you should have access to simulink.

Setting up Simscape

An overview of the directions can be found here:
First, you have to download a plug-in, Simscape, at this link:
Save the zip folder and matlab file in a convenient place where you have a Matlab directory. We will be using the file in Matlab later. Note: save the version corresponding to your Matlab (ie R2018a Win64)

Next, run Matlab as an adminstrator. This can be done by right-clicking the Matlab icon and choosing the run as administrator option.
Matlab Administrator
The file should already be saved in a location within a Matlab path, so enter "install_addon('zipname')" in the command window. Instead of zipname, use the name of the saved zip file.
Now, enter "regmatlabserver" in the command window to register Matlab as a server the plug-in can connect Solidworks to.

The last step is to enable Simscape on Solidworks. In the command window, enter "smlink_linksw".
Open Solidworks, go to Tools, and select Add-ins. Check the box for Simscape multibody link and a Simscape menu should appear in the menu bar when you open an assembly in Solidworks.

Running a simulation

First, open an assembly on solidworks. Under tools, there should be a Simscape option. Choose export.
Solidworks Simscape
Export the assembly by saving it as an xml file. This takes a while, especially for larger/more complicated assemblies.

In the command window of Matlab, enter "smimport('xmlname')" Rather than xml name, use the file name minus the ".xml"

You can actually run the simulation on Matlab. However, I tested this with the motor arm and the propellor flew off without the arm.....
How to use simulink to do a simulation you ask? I don't know yet