Dynamics/Linearization/Numerical Solutions/Single Variable with MATLAB

From testwiki
Jump to navigation Jump to search

Introduction

MATLAB Scripts can be simple and straightforward in linearizing and calculating a numerical solution to a non-linear expression of a single variable.

Using a MATLAB Script

The first two terms of the Taylor Series expansion, or linear approximation, result in the following:

f(x)f(a)+f(a)(xa)

Using MATLAB, there are a few options for performing linear approximations. Using this resource, we can run the following script to linear the following expression:

f(x)=x2+sin(x)+1

Template:Hidden

The figure shows a resulting depiction of the linearized function.

Linearization of x^2+sin(x)+1 using MATLAB

The linearized function near x=1 is the following:

f(a)sin(1)+ϵ(cos(1)+2)+2

We can substitute t for x in the expression:

f(x)=x2+sin(x)+1

Then, we create an appropriate block diagram as shown in the Figure.

Simulink block diagram for f(x)=x^2+sin(x)+1

We can then select the blocks between the ramp and the scope, right-click to create a subsystem block, select the new block, right-click an select "Linear Analysis", specify a point for linearization (t=1 in this case), linearize, and look at the resulting linear analysis in terms of state-space representation.

For our example, we find the "Model Linearizer" gives a static gain of 2.54 for our subsystem block.

Individual or Group Activity

  • Write down your own individual non-linear expression.
  • Use Taylor or binomial series expansion to create an analytical expression for the linearized form of your expression at a specified location.
  • Calculate the slope at that specified location.
  • Write a MATLAB script to create a symbolic linearized expression at the specified location.
  • Use Simulink to calculate the slope at the specified location.
  • Create a presentation in Google Slides titled "Linearized Expression with a Single Variable" to share in 2 minutes with the class.

References

Template:Reflist