Questions tagged [control-systems]

Questions on the use of Mathematica to analyze, design, and simulate continuous- and discrete-time control systems.

Filter by
Sorted by
Tagged with
30
votes
2answers
868 views

Can we use Mathematica for electronics design?

A spoiler alert: I intend to answer my own question. I am posting this because I would like to share my excitement regarding the control theory tools in Mathematica, and also to promote further ...
30
votes
2answers
2k views

Numerical optimal control

I was hoping to tackle optimal control using Mathematica in order to learn how I can use Mathematica's built in numerical integration and optimization functions together in order to solve an optimal ...
22
votes
2answers
931 views

Can we use Mathematica to design an electronic active filter?

How can we use Mathematica to design an electronic implementation of an active filter?
17
votes
1answer
1k views

Simulating discrete time stochastic dynamic systems

What is the canonical way of simulating discrete time stochastic dynamical systems in Mathematica using the new functionality of Random processes? To take a concrete example, lets consider the ...
13
votes
1answer
485 views

1D transient heat equation problem with controller

I would appreciate some help with following issue: I am trying to solve a 1D transient heat equation problem with a control loop in order to compensate a time variable boundary condition at one ...
12
votes
1answer
2k views

How to calculate the $H_2$ and $H_\infty$ norms of TransferFunctionModels or StateSpaceModels?

Lets assume we have a system model: ...
12
votes
1answer
890 views

Solving an optimal control problem (LQR)

Given a linear time-invariant system: $$ \dot{x}(t)=Ax(t)+Bu(t) $$ with initial state $ x(0)=x_0 $ and final state $ x(T)=x_T $. The performance measure to be minimized is: $$ \int_{0}^{T} ((x_T-...
11
votes
1answer
628 views

Solving optimal control problem when input is constrained

Given a linear time-invariant system: $$x'(t)=Ax(t)+Bu(t)$$ with initial state $x(0)=x0$ and final state $x(T)=xT$. The performance measure to be minimized is: $$∫_0^Tu(t)^2dt$$ The most important ...
10
votes
1answer
134 views

Working Precision in nonlinear control systems

When simulating a nonlinear control system using StateResponse , do the options WorkingPrecision, ...
9
votes
2answers
617 views

Why does NonlinearStateSpaceModel linearise?

The documentation for NonlinearStateSpaceModel says: In NonlinearStateSpaceModel[eqns, ...] the Taylor linearization is with ...
9
votes
1answer
583 views

How do you use SystemsModelFeedbackConnect?

I'm trying to grasp the new control system functions in Mathematica 8. I'd like to connect a controller model to a model of a plant to simulate the behavior of the system. I define a simple servo ...
9
votes
2answers
1k views

Adding noise to nonlinear control system using NDSolve

I have a nonlinear control system ...
9
votes
1answer
696 views

How to draw block diagrams as Graph objects?

In the documentation ClosedLoopResponsesWithAPIDController, There is a very nice block diagram. I want to create my own block diagrams similar to this. I clicked on the diagram and pressed "command-...
8
votes
2answers
339 views

Converting a backward/forward sweep code for optimal control to _Mathematica_

I'm trying to convert to Mathematica a simple backward/forward sweep (with RK4 integrator) code to solve an optimal control problem in epidemiology, but I'm getting some error messages and I cannot ...
8
votes
1answer
741 views

How is this StateSpaceModel derived?

Modifying an example from the documentation, StateSpaceModel[{a x'[t] + b x[t] == c u'[t] + d u[t]}, {{x[t], 0}}, {u[t]}, {x[t]}, t ] (state ...
8
votes
1answer
1k views

How to convert a transfer function model to a zero-pole-gain model?

Mathematica has a function to convert TransferFunctionModels to StateSpaceModels: mytf=TransferFunctionModel[(2 s + 3)/(s^3 + 4 s^2 + 5), s] StateSpaceModel[mytf] ...
8
votes
1answer
192 views

Problems with StateSpaceModel in v10.2

Bug introduced in 10.0.2 and fixed in 10.3 I don't know if this is a bug, or if just something changed I can't figure out. Take the following examples: ...
8
votes
1answer
173 views

On using DiracDelta[t] in OutputResposne in version 10. Different result from version 9

I am baffled by this. I was trying to run same example I had working in version 9.01 and found now I get empty plots. The example is here . Here is a simplified version of the above. The same exact ...
7
votes
3answers
2k views

Laplace: from differential equation to transfer function

First at all, this is trictly related to my own question: How to transform transfer functions into differential equations? How can I transfer my differential equation into a transfer function? For ...
7
votes
2answers
2k views

How to transform transfer functions into differential equations?

is there a way with Mathematica to transform transferfunctions (Laplace) into differential equations? Let's say I have the transfer function $\frac{Y(s)}{U(s)}=\text{Kp} \left(\frac{1}{s \text{Tn}}+1\...
7
votes
1answer
275 views

How to implement a Kalman or LQG regulator in the control of classical pendulum problem

My final purpose is to realize an LQG control of inverted pendulum. To this end, my first step I think is to build a Kalman regulator in Mathematica. The original Matlab version of Kalman filter is ...
7
votes
1answer
1k views

Does Mathematica solve transfer functions differently from MATLAB?

I'm using Mathematica to derive the transfer functions for a three phase AC/DC inverter. Given below is the code for the derivation of the transfer function for a third order filter (LCL) connected ...
7
votes
1answer
235 views

Issues with modeling pulses in a very simple system of DAEs

Bug introduced in 10.4.1 or earlier and fixed in 11.0.0 Bug has been confirmed by WRI [Case:3594387]: It does appear that the NDSolve function is not behaving properly in this case and an incident ...
7
votes
1answer
1k views

Kalman filter by hand

I am now learning the Kalman filter and wants to implement it by hand to understand it better. To be specific I want to first simulate a sequence of data by $$ \dot x=Ax+Bw\\ y=Cx+Dv,\\ E[x(0)]=0,E[x(...
7
votes
1answer
371 views

Using the LQGRegulator to build a human operator model

I'm trying to build a human operator model using an optimal control model in Mathematica: The vehicle dynamics are given by ...
7
votes
1answer
1k views

Estimate parameters of the state space model

I'm using Mathematica 9 and its Control Systems functionality. I've searched the references extensively but seem not to be able to find any examples of state space model parameters estimation. All ...
7
votes
1answer
332 views

Connecting Inputs and Outputs of Transfer Function Models

I am trying to use Mathematica's TransferFunctionModel object and SystemsModelFeedbackConnect function to approach the following ...
6
votes
3answers
6k views

DC gain of a transfer function

Consider this example. M = TransferFunctionModel[3/(s^2 - s + 5), s] the DC gain should be the value of the transfer function ...
6
votes
1answer
123 views

What does BodePlot actually calculate?

I'm using Mathematica v12.3 student edition, running on Windows 10 Home (AMD Ryzen 5 4500U with Radeon Graphics 2.38 GHz). I'm trying to get a Bode plot of an example function. I try to do it with the ...
6
votes
1answer
358 views

Problem with optimal control and Pontryagin's maximum principle

For dynamic system: $\dot{x}=\frac{df}{dx}+u$ where $f=e^{-x^2}$ It is necessary to develop optimal control, minimizing criterion: $J= \int_{0}^{t_f} ((\frac{df}{dx})^2+u^2) \,dt $ Algorithm: We ...
6
votes
1answer
382 views

Estimation of parameters of limit cycles for systems of high-order differential equations (n> = 3)

There is a system of differential equations: Then, call the limit cycle the projection of the phase trajectory onto the plane in a pairwise combination of state variables ($x-y,y-z,x-z$). where $x,y,...
6
votes
2answers
204 views

ToDiscreteTimeModel fails following video

Following the systems-modeling video here at about 15 min, 20 seconds in, the presenter (Bob Sanhedrick, I think) shows a model for an "Asteroids-game"-like 2D spacecraft. The model is ...
6
votes
1answer
268 views

Understanding code generated by MicrocontrollerEmbedCode

I've been using MicrocontrollerKit for a while now to generate code for little projects, inverse pendulums, filters, etc. Generally it works well. I am now currently trying to design a LQI (Linear ...
6
votes
1answer
240 views

Do we need to know the input signal when we use KalmanEstimator?

The first "Application" in the documentation for KalmanEstimator is copied below with additional variables for clarity. ...
6
votes
1answer
128 views

Implicit Riccati Equation Solver (to find the anti-stabilizing solution)

I've found that the latest MATLAB icare() solver includes the possibility to find also the anti-stabilizing solution of the Riccati equation. I haven't found a ...
6
votes
1answer
258 views

Extended Kalman Filter by hand

While trying to learn a bit about control theory, observers and most importantly, to use Microcontroller Kit in version 12 of MMA, I've stumbled upon the KalmanEstimator. After reading a bit (and ...
6
votes
1answer
197 views

Non-linear ODE from closed-loop system and Response

I started using Mathematica 12 and ran into difficulties. Namely, I want to compare the results of the calculation of a closed system from Simulink and in Mathematica. I rummaged around a bit on the ...
6
votes
1answer
108 views

How to use RiccatiSolve with symbolic matrix

According to the RiccatiSolve documentation the Eigensystem method can apply to symbolic matrices. However, I can not get it to ...
6
votes
1answer
563 views

System Identification from test data

I've been looking for a way to model a simple SISO system from test data using Mathematica. Something similar to MATLAB's System Identification Toolkit, that estimates a transfer function from the ...
5
votes
3answers
842 views

Mathematica and MATLAB giving different results from inverse Laplace transform [closed]

Given the transfer function gs = (5*s + 4)/(s^4 + 4*s^3 + 2*s^2 + 3*s); and the input signal ut = Sin[t + π/6; I want to get ...
5
votes
3answers
3k views

How to fix BodePlot that comes with Mathematica?

I am using Mathematica to go through the examples and exercises on the book Modern Control Systems, 6th edition by Dorf. On page 605, there is a table (Table 8.5) with the Bode plot for several ...
5
votes
2answers
1k views

Convert DE to first order?

I have the following set of second-order differential equations: ...
5
votes
1answer
10k views

How can I draw an asymptotic bode plot?

When I use Mathematica to draw a bode plot, it always gives the precise version, like this: BodePlot[(10 (s + 3))/(s (s + 2) (s^2 + s + 2))] How can I draw the ...
5
votes
2answers
1k views

Evaluation problems with NDSolve using the fixed step ExplicitEuler-Method

Motivation I am using Mathematica to implement System Dynamics (SD) models, e.g. differential equation models as applied to management/economic problems following the "methodology" of Jay W. ...
5
votes
3answers
483 views

Strange behaviour of OutputResponse

I am having some trouble when using OutputResponse. For instance consider the following command ...
5
votes
1answer
2k views

Unit of the frequency axis in BodePlot

I have a simple question: What is the unit of the frequency axis in the BodePlot? I searched the documentation, but only found this: The scaling functions can be specified as ScalingFunctions->{{...
5
votes
1answer
584 views

Problems with RootLocusPlot

I am having some trouble to understand how the RootLocusPlot works (options, drawing and etc.) Here is an example ...
5
votes
1answer
359 views

Solution to the inverted pendulum problem (system of non-linear ODE)

A classic control systems problem is that of the translational inverted pendulum, as shown below. By applying a force $f(t)$ to the car (e.g. through a DC motor attached to the car), the goal is to ...
5
votes
1answer
500 views

Label State Space Models converting ODEs

Say I have a set of differential equations not necessarily in first order form. I would like to build the corresponding state space model. When equations are many and long, it becomes difficult to ...
5
votes
1answer
102 views

Is there a better way to simulate quadratic cost MPC problems?

Question I would like to know if there is a more straightforward or a better way to simulate MPC problems in terms of code length and accuracy as compared to what I am doing. I am looking to know if ...