File Exchange

image thumbnail

Simscape Language: Nonlinear Spring

version (232 KB) by Steve Miller
Simscape™ language example of nonlinear mechanical springs


Updated 01 Sep 2016

View Version History

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

This file contains Simscape language source code for nonlinear springs. One example uses a custom equation and the other uses a lookup table.
To view a video (3 minutes) showing a nonlinear spring example, go to:
To view a webinar (35 minutes) about the Simscape language, go to:

To learn more about MathWorks Simscape products, go to:

Cite As

Steve Miller (2021). Simscape Language: Nonlinear Spring (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Alberto Mora

Steve Miller

Hi Talha and Kartik - to see how to connect Simscape 1D mechanical components to Simscape Multibody 3D models, look at

Talha Ilyas

hey kartik, Did you find any solution for the problem?
I want to add the torsional springs instead of rigid body in the robotic legs. I made a model using solid works which i exported as xml file. There I used the springs but obviously they did not translated the same behavior into Matlab. So i deleted the springs ' "solid block" and its reference frame and kept the transformation frames which are connected on both side. but if i add in the middle the springs, the geometry of my model gets messed up infact i can not see some of the body parts. should''nt they suppose to stick together as my transformation frames are there and i added the spring in the middle of that.


Hey, the spring is not attaching to my simscape model. My model has frames and solid bodies defined and i want the nonlinear spring between the reference frame and the solid body.
Help is appreciated, Btw I am new to simscape.

hooman shirzadi


Erdal Bizkevelci

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!