Skip to main content
33 votes

Can we use Mathematica for electronics design?

An example of electronics design is the design of amplifiers using operation amplifiers (op amps). One common configuration is the inverting amplifier depicted below in a schematic entered in LTSpice (...
David Keith's user avatar
  • 4,604
26 votes

Can we use Mathematica to design an electronic active filter?

Here I would like to share with this great community by offering an example of active filter design. Introduction This Mathematica code determines the component values for a low-pass active filter ...
David Keith's user avatar
  • 4,604
18 votes
Accepted

Mathematica and MATLAB giving different results from inverse Laplace transform

You missed one term in Matlab. den=[1,4,2,3,0]; and not den=[1,4,2,3]; The order is important in Matlab. Since you do not have ...
Nasser's user avatar
  • 147k
16 votes

Solving optimal control problem when input is constrained

Semi-smooth Newton solver This is supposed to solve constrained optimization problems of the form $$ \text{Minimize } F(x) \text{ subject to } \varPhi(x) = 0 \text{ and } \varPsi(x) \leq 0.$$ More ...
Henrik Schumacher's user avatar
14 votes
Accepted

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

These aren't actual limit cycles and what you're looking for has a fuzzy definition (notice how the amplitude increases in each pass). However this is still fun to play with, so let's see what we can ...
Chris K's user avatar
  • 20.3k
12 votes
Accepted

Why does NonlinearStateSpaceModel linearise?

Consider a model where the nonlinearity is in $x'(t)$ and not in the highest derivative $x''(t)$. eq1 = {x''[t] + Sin[ x'[t]] + x[t] == u[t]}; Choose the first ...
Suba Thomas's user avatar
  • 8,796
12 votes
Accepted

Problem with optimal control and Pontryagin's maximum principle

Pontryagin's minimum principle means that we have to use Euler-Lagrange equations. Therefore code looks like this ...
Alex Trounev's user avatar
  • 46.2k
11 votes
Accepted

How is this StateSpaceModel derived?

The standard method depends on what is called state space realization. Which involves determining $A,B,C,D$ from the transfer function of the ODE. The standard form of state space representation is ...
Nasser's user avatar
  • 147k
10 votes
Accepted

Solving an optimal control problem (LQR)

my solution A={{-1,0.5},{0.3,-1}}; B={{1},{1}}; x0={{1},{0}}; xT={{0},{1}}; You have to choose an end time T=10; Next you ...
OhmSweetOhm's user avatar
10 votes

Why does NonlinearStateSpaceModel linearise?

My guess is to be able to have the same internal representations as for linear systems. It is not possible to represent a system using A,B,C,D state space standard ...
Nasser's user avatar
  • 147k
10 votes
Accepted

Frequency Response

In Mathematica, you can work with the function h(z) directly, since Mathematica is symbolic based. In other words, while in Matlab one needs to work for numerical ...
Nasser's user avatar
  • 147k
9 votes
Accepted

Discrepancy between Matlab and Mathematica

Using Mathematica 10.4.1 (Windows 7) the following code finds a pretty good match with the Matlab results. (And I'd argue that any differences between the two are due to differences in how the ...
JimB's user avatar
  • 42.1k
9 votes
Accepted

1D transient heat equation problem with controller

Here is a way to do it: ...
user21's user avatar
  • 40.1k
9 votes

Mathematica and MATLAB giving different results from inverse Laplace transform

With Mathematica you can also do the following ...
rmw's user avatar
  • 1,950
8 votes
Accepted

How to index multi-dimensional vectors in NDSolve/WhenEvent?

You need to construct an event for each i from 1 to n: ...
Michael E2's user avatar
  • 239k
8 votes
Accepted

DC gain of a transfer function

The k in zpk is not the same as the dc gain. Given transfer function $\frac{num(s)}{den(s)}$, we write the tf in the form $k\frac{(s-z_1)(s-z_2)\dots}{(s-p₁)(s-p₂)\dots}$ where $z_{i}$ are the zeros ...
Nasser's user avatar
  • 147k
8 votes
Accepted

Simulating a combination of PDEs and ODEs

This problem can be solved with the help of pdetoode. We first eliminate Ib0 and Ib1 from ...
xzczd's user avatar
  • 67.1k
8 votes

Solving Differential Equation System for HIV Treatment Model

Structuring the script. ...
Cesareo's user avatar
  • 3,963
8 votes
Accepted

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

The system sysC needs to be modified as ...
Suba Thomas's user avatar
  • 8,796
8 votes

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

According to chapter 9, "Mathematica’s NDSolve can take in boundary conditions, and system (9.26) can be directly input into it" (p. 239). Let's give it a try. ...
Chris K's user avatar
  • 20.3k
8 votes
Accepted

What does BodePlot actually calculate?

Your understanding of what BodePlot (with the default ScalingFunctions->{Automatic,"dB"}) computes is correct. ...
George Varnavides's user avatar
8 votes

Transfer function for Rayleigh-Plesset equation

You can't have transfer function for nonlinear ode. You have to either first linearize it around some operating point, or use nonlinear state space representation. Mathematica has ...
Nasser's user avatar
  • 147k
6 votes
Accepted

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

The short answer is yes, we need to know the input signal when using the Kalman filter. Let's consider an example. Let's say we have a robot and we want to estimate it's position as it drives around ...
xslittlegrass's user avatar
6 votes
Accepted

Matrix Solve for a particular form

LyapunovSolve[] is designed for this: ...
J. M.'s missing motivation's user avatar
6 votes
Accepted

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

Things work much better if you use vectors instead of row/column matrices. Using LinearSolve[] and Chop[] in this case also ...
J. M.'s missing motivation's user avatar
6 votes
Accepted

Analyze stability of equilibria using Routh-Hurwitz conditions

There are "modified Routh-Hurwitz criteria" that work directly on the Jacobian matrix that I prefer and don't seem very well known (Fuller 1968). Here's a function I wrote that uses them for up to ...
Chris K's user avatar
  • 20.3k
6 votes

Mathematica and MATLAB giving different results from inverse Laplace transform

With Mathematica, I get significantly different results than your Mathematica results. I do not have access to matlab nor know whether the matlab code shown is correct. ...
Bob Hanlon's user avatar
  • 160k
6 votes
Accepted

Understanding code generated by MicrocontrollerEmbedCode

The value 84.38063590995105=-26.8592*π is a residue that pops up if the equilibrium value is not set correctly. There are a few things that need to be changed to ...
Suba Thomas's user avatar
  • 8,796
6 votes
Accepted

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

Do I have to use NDSolve? Yes If so, how? Something like ...
Nasser's user avatar
  • 147k
6 votes

Calculating the n derivative of state space equations

I would like to calculate the system state after n steps To do that, use OutputResponse. This gives the output of the system. You decide on how long to look at the ...
Nasser's user avatar
  • 147k

Only top scored, non community-wiki answers of a minimum length are eligible