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
2
votes
2answers
148 views

Lagrangian of three-mass system with Mathematica

Before proceeding to calculations in Mathematica, I would like to clarify with knowledgeable people. There is an ordinary linear three-mass system. If we write its Lagrangian, we get the following ...
1
vote
1answer
49 views

Representation in state-space of a system with ideal and real differentiating links in feedback

There are two systems in the state space with an ideal and a real differentiator. For the first system, the code in Mathematica is as follows. ...
2
votes
1answer
65 views

Output response for state-space with piecewise nonlinear elements

In addition to the previous topic: System model merge with multiple input and one output For example, I am trying to reproduce a system from simulink, a diagram of which is shown in the figure below:...
2
votes
1answer
79 views

System model merge with multiple input and one output

I was curious, and I used the built-in functions of Mathematica to analyze the following scheme: I used SystemModelMerge as: ...
1
vote
1answer
52 views

Problem when solving Kalman filter in Mathematica: How to define a spectral density matrix and calculate the covariance matrix?

I am reading the classic book on state-space control theory by Bernard Friedland. In order to strengthen my understanding of Kalman filter, I want to reproduce Example 11A (Inverted pendulum on page ...
1
vote
1answer
69 views

Why doesn’t x’ = a.x + b.u, y = c . x + d.u hold in this state-space model?

I have noted that sometimes state variables may change (thanks Thomas’s help :)), due to the Mathematica’s internal automatic transformation from a descriptor state-space model to a standard state-...
1
vote
1answer
40 views

Confusing behavior of LQR control that strongly depends on system output (with odes solved by NDSolve)

I am implementing a LQR control of a 3-floors structure. Firstly, I obtained a reasonable result with my first code (Code 1 as shown below). In this code, the ...
7
votes
1answer
136 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 ...
1
vote
1answer
68 views

Strange output of a simple statespace model

The output of statespace model seems strange. In the follwing code, the odes are governing equations of a three floors structure, and the output are three accelerations of floors. If I ...
2
votes
1answer
44 views

Does NonlinearStateSpaceModel work with symbolic constants?

I'm trying to put a nonlinear system of two 2nd order ODEs given by: ...
1
vote
1answer
98 views

Experiments with Feedback Linearization and StateTransformLinearization in Mathematica

I have some nonlinear system, and i have three big question: Non-linear ODE from closed-loop system and Response 1. how correctly use such terms, like "Feedback Linearization and StateTransform ...
5
votes
1answer
141 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 ...
1
vote
1answer
53 views

Error with StateSpaceTransform: the rule based transformation must be of length 2

I would like to perform a change of variables on the following dynamics system: ...
2
votes
3answers
114 views

PIDTune and characteristic equation of zero

I have a BLDC electric motor, I'm currently trying to control via a PIDTune. This is mostly an attempt to reduce (remove) a small run away drift that ends up ...
5
votes
1answer
119 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 ...
30
votes
2answers
519 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 ...
1
vote
1answer
72 views

Speeding up the calculations by Reduce and NSolve

I have a non-linear system of equations with numeric parameter values as shown below. I first tried FindRoot with given initial values and it did not converge. Then ...
1
vote
1answer
70 views

StateTransformationLinearize - references?

I am impressed by StateTransformationLinearize, and I feel terribly bad for not having noticed this function before. How does it work? Does it attempt to find a $...
1
vote
1answer
275 views

Solving Differential Equation System for HIV Treatment Model

I was working on a project about optimal strategies for HIV treatment, models used from [Butler, Kirschner, and Lenhart] 1997. This model explains the spread of HIV viruses in the human body, where ...
1
vote
1answer
52 views

Manual control plots differ from StateResponse and OutputResponse

So In my quest to try to learn some control theory inspired by the following link, I have been modeling an inverse pendulum regulated with a flywheel. The system model is pretty ok I think, and when ...
2
votes
1answer
71 views

OutputResponse and contradictory control models

So I'm trying to learn some control theory for a little project I'm working on and decided I'd try the examples of pendulum and cart one can find all over the internets, and I'm following this post ...
2
votes
2answers
229 views

BodePlot with magnitude in db or log scale

I have to plot a BodePlot with magnitude in db or log, but i could not find the option for setting the magnitude scale. ...
2
votes
1answer
322 views

Analyze stability of equilibria using Routh-Hurwitz conditions

For an assignment, I need to analyze the stability of a system very close to equilibrium, using "Routh-Hurwitz conditions". I have already obtained the characteristic equation of my system, but I do ...
3
votes
2answers
121 views

Inconsistencies when using BodePlot with `StateSpaceModel` and `TransferFunctionModel`

Consider a linear system . ...
2
votes
0answers
69 views

Accuracy problem with BodePlot

Hoping to find a quick answer to a question of frequency response of multiple band-pass filters in closed loop, I opened up Mathematica,and entered the first set of ...
2
votes
1answer
190 views

Simulating a combination of PDEs and ODEs

I am trying to simulate a combination of PDEs and ODEs, given below. $$ \begin{matrix} -L\dfrac{\partial}{\partial t}I(t,z)&=&\dfrac{\partial}{\partial z}V(t,z)+RI(t,z)\\ C\dfrac{\...
3
votes
1answer
92 views

BodePlot of Warburg impedance - Errors

I'm trying to plot the Bode diagrams of the Warburg impedance (A=1, s=jw): $$Z=\frac{A}{\sqrt{\omega}}+\frac{A}{j\sqrt{\omega}}$$ $$Z=A \sqrt{\frac{j}{s}}+\frac{A}{j}\sqrt{\frac{j}{s}}$$ ...
2
votes
1answer
91 views

Event Trigger Ode's

I am trying to simulate a Hybrid system using the WhenEvent function in Mathematica. I have asked this question earlier. It was not an MWE. Now I tried to make an ...
1
vote
1answer
75 views

AxesLabel in a phase plot in the BodePlot command

I've the following code: ...
1
vote
0answers
43 views

Finding the mathematical function is plotted by using the bodeplot command

I've the following code: ...
2
votes
1answer
41 views

bodeplot phase in normal scale

I've the following fuction: ...
5
votes
1answer
293 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 ...
3
votes
2answers
319 views

Is it possible to find the transfer function of these three differential equations using Mathematica

Imagine you are attempting to obtain a model of a device with two inputs [u1, u2] and three outputs [O1, O2, x] from the Lagrangian. After some of Lagrangian work, you find the following three ...
8
votes
2answers
531 views

Why does NonlinearStateSpaceModel linearise?

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

Searching for poles of a transfer function on the edge of stability

I just started using Mathematica and I am a bit stuck. I want to compute poles of transfer function that are on edge of stability i.e. Re[s] = 0 and I want to find ...
10
votes
1answer
572 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-...
0
votes
1answer
120 views

Solve for input with given TransferFunctionModel

I obtained the transfer function for an electrical system from experimental data (left plot). Thereby, I can calculate the output voltage response for a given voltage input, using ...
1
vote
3answers
88 views

Can't find solutions to an equation involving a variable in eigenvalues

In control sytems we know that a system is of order 2 if there are two different eigenvalues such that they ratio is 10. In this case I want to find the controller gain that makes the above possible. ...
2
votes
2answers
324 views

Mathematica returns 1 for the denominator when clearly it isn't equal to 1

I'm trying to get the transfer function of a system from the State Space representation. It is given by $h(s)=C(sI-A)^{-1}B$ with I the identity matrix. Then I want to find the poles, so the idea is ...
5
votes
1answer
382 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 ...
1
vote
1answer
44 views

Factor by a specific literal (i.e factor by $s^N$ a transfer function)

I've found the closed loop transfer function but I want to know the order of it. So, the idea is to factor the denominator by the highest exponent of s to get an expression like this one: $$ l(s)=g(s)...
2
votes
1answer
73 views

Matrix Solve for a particular form

Suppose that we have two matrices $\mathbf A$ and $\mathbf B$ which are known to us and both of them are square matrices of the same dimensions. Now we want to find a square matrix $\mathbf C$ that ...
0
votes
0answers
87 views

Wrong answers while trying to analyze stability

I want to analyze the stability of a closed-loop system (with feedback). The idea is to choose a proper gain kc for the controller. The code is the following: ...
3
votes
1answer
132 views

Unable to find proper solutions through “Solve” or “NSolve”

I'm working on a problem that involves a CUK converter. In control theory, a system is marginally stable if the real part of all eigenvalues are equal to zero. Actually, the eigenvalues of a matrix $A$...
2
votes
1answer
121 views

Running a feedback control system problem

I'm trying to work with a feedback control system. The general scheme is: So the input $u(t)$ is supposed to be: $u(t)=k_a\cdot k_{st}\cdot h_c \cdot e(t)$ where $k_a,k_{st},k_c$ are the transfers ...
4
votes
2answers
62 views

Possible problem with method of resolution of differential equation

I'm trying to simulate an elevator circuit. I divided the problem in two steps. First step: simulate the problem with $d(t)$ and $e(t)$ constant. The final conditions of this system will be the ...
1
vote
0answers
69 views

Plotting a switching function

I'm trying to use a switch-function. I'm using $d(t)=d_o+\Delta d_1*UnitStep(t-0.01)+\Delta d_2*UnitStep(t-0.04)$ and a sawtooth function with period 0.002 and amplitude 1. To generate the sawtooth ...
3
votes
1answer
154 views

What KalmanEstimator elements tells us?

I'm looking for an interpretation of Kalman filter in discrete time. You know, if we consider an state space on the form of the form ...
0
votes
1answer
573 views

How to plot points on Bode plot curves

I used BodePlot to plot the magnitude and phase plots for a transfer function Gp1 and I figured out how to add a point to the ...
1
vote
1answer
172 views

How do you mark/show the critical point (-1, 0) on Nyquist plot? [closed]

I am trying to make the Nyquist plot of the function $\frac{200}{(s+1)(s+2)(s+3)}$ as below. However, I would like to see mark the critical point (-1, 0) on the plot so we can see clearly whether the ...