Skip to main content

Questions tagged [matlab]

For mathematical questions about MATLAB; questions purely about the language, syntax, or runtime errors would likely be better received on Stack Overflow. MATLAB is a high-level language and interactive programming environment for numerical computation and visualization developed by MathWorks.

Filter by
Sorted by
Tagged with
0 votes
0 answers
12 views

generalized poisson moment function approach to initalize input output model

I am trying to understand how the Generalized Poisson Moment Functions apporach is a way to initalize the nominator and denominaor of a LTI-Model that describes the connection between Input and Output ...
ThorbenL's user avatar
1 vote
1 answer
54 views

Hadamard matrix of order 28 via Paley 1 construction [closed]

The Paley 1 construction method allows to construct an Hadamard matrix (square matrices with orthogonal columns and entries equal to $1$ or $-1$ ) of order N = q+1 where q = 3 (mod 4) is a prime power:...
P. Bul's user avatar
  • 31
0 votes
0 answers
18 views

Generating MA Process in matlab using gaussian nosie

I have an MA process that is: $x[n] = a * w[n] + b * w[n - 1] + c * w[n - 2]$ Where $a, b, c \in \mathbb{R}$ and $w \sim \mathcal{N}(0, \sigma^{2})$ How can I generate $x[n]$ in Matlab ? I know that ...
Daniel Cohen's user avatar
0 votes
0 answers
9 views

Understanding sentences in sptenrand() in tensor_toolbox

When I try to figure out the meaning of the codes of the sptenrand() function to write a function to create a sparse tensor with a different distribution, I am stacked in the following two steps: ...
vanessa yan's user avatar
1 vote
0 answers
48 views

Numerically solving Pontryagin's Maximum Principle

I am trying to understand why when solving this boundary problem in matlab is significantly impacted by the $A_0$ matrix. The optimal control problem I am trying to solve reads: $$ \begin{aligned} ...
zzgsam's user avatar
  • 139
1 vote
1 answer
75 views

Solve ill-conditioned linear systems

Consider the following linear system of equations : $$Ax = b$$ When solving this system using MATLAB, I found that the condition number of matrix $A$ is extremely large, indicating that the system is ...
Elliot's user avatar
  • 31
0 votes
1 answer
45 views

Matlab qz algorithm not reliable

I programmed my own version of the qz algorithm and, while testing it's results using the matlab qz algorithm, I found a particular case where my solution reaches an upper-triangular matrix and matlab ...
Littlejacob2603's user avatar
1 vote
0 answers
12 views

Getting concave function accepted by CVX

Part of my problem is maximizing the minimum magnitude squared of vector elements (x = [x_i]). This is not a convex problem as min is taking convex expressions. One way to work with it is by ...
Aya's user avatar
  • 11
0 votes
1 answer
63 views

how can I vectorize this double summation in Matlab?

I have to find $P(s,t) =\sum^2_{j_1=1}\sum^4_{j_2=1} x_j s^{j_1-1} t^{j_2-1}$ with $j = (j_1-1)2+j_2$ and x a vector of size (1×4) ( in this example a random x is fine). The less efficient manner to ...
Massimiliano Messina's user avatar
0 votes
1 answer
110 views

Differential Equation to Linear State-Space Model

I derived a differential equation for a system that I am studying that takes the following form: $$\dot{x}-au_1(x-x_0)=bu_2+cu_1$$ This was derived from expanding a non-linear differential equation as ...
b7031719's user avatar
0 votes
1 answer
67 views

erfcinv is giving incorrect results in MATLAB

I am working on a Communication Theory problem. To summarize the problem, I have to code the following: Plot the ideal bit error probability for BPSK, which is given by $Q(\sqrt{\frac{2E_{b}}{N_{0}}})...
AverageStudent123's user avatar
0 votes
0 answers
19 views

Output of convolution of a shifted box function and an impulse response of low pass filter

I want to convolve this input: Box delayed input function with a low pass filter, with R is resistance in 2000 Ohm and capacitance in F is $1.5*10^{-8}$ And impulse response of the filter is $$h(t) = \...
ferer's user avatar
  • 1
0 votes
0 answers
57 views

Matlab code for solving inhomogeneous 1D heat equation using Crank-Nicolson

I'm trying to solve the 1D heat equation using Crank-Nicolson in Matlab. The problem is, my numerical solution is not the same as the exact solution. (I already checked the plots and their shapes are ...
Kim Juhee's user avatar
0 votes
0 answers
24 views

Convolution with a time shifted box function

I have the input: Delayed box input Its a box funciton x2(t-0.00225) with L = 0.0005 where it's 1 when 0.002 <= t<= 0.0025 and 0 elsewhere. I want to convolve this with the impulse funciton of a ...
ferer's user avatar
  • 1
0 votes
0 answers
31 views

How to plot two seperate sequences in one plot such that there difference is clear?

Suppose I have two sequences $a_n$ and $b_n$. They both start from a very high number say $25000$ and converges to zero. If I plot them in one plot, as they start from a very large number, the plot ...
Newrion's user avatar
  • 361
0 votes
0 answers
69 views

Exploring Convergence and Root Determination with Fixed-Point Iteration

Understanding Fixed-Point Iteration: Exploring Convergence and Root Determination The equation $$2x^2 - 7x + 6 = 0$$ has two positive roots. We aim to determine these using the following fixed-point ...
Need_MathHelp's user avatar
0 votes
0 answers
11 views

Logit panel with Simulated Maximum Likelihood

I'm testing a very basic logit panel model in matlab. The setup is as follows: We observe a binary variable $y_{it} = 1(\beta_0 + \beta_{it}x_{it} + \varepsilon_{it} > 0)$ where i is individual and ...
Mark F's user avatar
  • 33
1 vote
1 answer
59 views

Binary choice with mixture of normal errors estimation

My problem is simplified as follows: I'm estimating a binary choice probit model where the error term follows a mixture of two normal distributions. This is: $y_i = \mathbf{1} \left( \beta_0 + \beta_1 ...
Mark F's user avatar
  • 33
0 votes
0 answers
76 views

Singularity of a non- linear second order ODE

I have the encountered a singularity in the equation below . $$ y^{\prime \prime}(x)+\frac{2}{x} y^{\prime}+\left[y-\left(1+\frac{2}{x^2}\right)\right] y(x)=0, \quad 0<x<+\infty, $$ with ...
SR9054505's user avatar
0 votes
0 answers
67 views

Simulating an ODE

I am trying to simulate a ODE system written in the caption of Fig. 4 in the paper on Contraction of monotone phase-coupled oscillators. $$\dot\theta_i=\sum_{j}A_{ij}\cdot\eta(\theta_i-\theta_j)$$ ...
chloe's user avatar
  • 1,052
0 votes
0 answers
68 views

Converting nonlinear matrix inequality into an LMI

I need the following inequality to hold; $$ M+(CK)^{\text{T}}NCK > 0 $$ where $$ C \in \mathbb{R}^{m \times p}, ~~~ N=N^{\text{T}} > 0 \in \mathbb{R}^{m \times m} $$ are known, and $$ M=M^{\text{...
AdamsK's user avatar
  • 307
0 votes
0 answers
123 views

Can't find cycles in dynamical system

I do my homework and got stuck. Let my system is: $$ \left\{ \begin{array}{ll} \dot{x}=22x^2 + 30xy + 10y^2 + 34x + 20y + 1; \\ \dot{y}= -29x^2 - 41xy - 14y^2 - 58x - 34y - 2; \\ \end{array} \right....
ouazou's user avatar
  • 29
0 votes
1 answer
78 views

Sensitivity of Newton's method initial vlaue

Can someone explain to me what sensitivty refers to when it comes to root finding? When we say it is sensitive to initial value for x, is because there are multiple roots, or because there might be a ...
Need_MathHelp's user avatar
-1 votes
1 answer
59 views

How do I solve the following system of 2D pde [closed]

I dont have a background in maths and this is my first time dealing with pdes, trying to solve $$ \begin{matrix} \frac{\partial n_c}{dt} \\ \frac{\partial n_p}{dt} \\ \end{matrix} =\begin{pmatrix} ...
Cal Ng's user avatar
  • 1
0 votes
1 answer
30 views

Calculation of Shortest Paths in a Directed Graph takes much longer than calculating Betweenness Centrality

First of all, I am trying to calculate the Betweenness Centrality of a fully connected directional graph with edge weights with N=3015 nodes. Matlab can do this in about 30 seconds and Python igraph ...
Dom's user avatar
  • 256
0 votes
0 answers
13 views

Circle_cap coding in matlab

I would like to write a code to plot a circle cap like the shape below. In fact, $r,\; \theta$ and $a$ are given and I want to plot it using them. Note: It is not difficult to see that $a=r\sin \...
6-0's user avatar
  • 654
0 votes
0 answers
43 views

Getting complex solution with Matlab ode45

I'm trying to solve such an ODE: $$U'(\alpha) = \frac{\alpha DU(\alpha) + A\alpha + C + \sqrt{BU(\alpha)}}{D(\alpha^2 - \alpha)}$$ with boundary condition $U(a) = 0.$ I have such a problem that if ...
Isn't Adobe Acrobat the best's user avatar
0 votes
0 answers
36 views

Iterative shrinkage algorithm for L1 optimization - A MATLAB Code testing

I am going to solve the problem: $x =: \underset{x}{\text{argmin }}\frac{1}{2}||y-Ax||^2+||x||_1$ using iterative shrinkage algorithms (ISTA). There is a modified version know as FISTA which is as ...
user3482383's user avatar
0 votes
0 answers
53 views

(MatLab) patternCustom 3D radiation plot not showing up

I am working on an antenna array working within wifi spectrum (2.4 GHz to 2.4835 GHz) for a university project, and as a part of that I have gotten it tested in a MVG SG24 with a frequency sweep from ...
JPed's user avatar
  • 1
0 votes
1 answer
55 views

Planes equation

I have two parallel lines: T2: (x−3)/2 = (y-2)/1 = (z+2)/2; T3: x = 1 + 4s, y = 1 + 2s, z = −3 + 4s, −∞ < s < ∞ And i need to find a plane that contains them both but the plane i keep getting ...
Joe James's user avatar
0 votes
0 answers
20 views

To explain the appearance of an imaginary unit in the algebraic form of a record

In my code, I am looking for an algebraic expression for the maximum point. There is an imaginary unit in it, although when substituting numerical variables, I see that the imaginary part is not there....
Vaisala's user avatar
  • 17
0 votes
1 answer
80 views

Riccati equation in matlabs icare solver

I'm using the icare riccati equation solver from MATLAB to solve lqr problems were the constraint is given by the equation $My^{\prime} = Ay+Bu$ where for context M (mass matrix), A (stiffness matrix) ...
mlg3371333's user avatar
2 votes
0 answers
58 views

Can't get proper numerical convergence for complicated Advection-Diffusion-Reaction PDE

I have trying for quite some time to write a finite difference solver for the following advection-diffusion-reaction differential equation: $$ \frac{\partial C}{\partial x} = \frac{1}{u(z) + u_e(x,z)}\...
David G.'s user avatar
  • 292
0 votes
1 answer
37 views

How to obtain antiderivative numerically with known partial derivative matrices using MATLAB?

assuming an unknown original function is $f(x,y)$, now I have its partial derivatives $\frac{\partial f}{\partial x}$ and $\frac{\partial f}{\partial y}$ expressed by two matrices $\mathbf{A}$ and $\...
Xin Liu's user avatar
  • 11
0 votes
0 answers
61 views

How to write mathematical ODE equation of PI controller, with saturation and rate limiter in differential equation form?

I want to write a mathematical ODE equation of PI controller, with saturation and rate limiter in differential equation form. I can write PI controller, but how to incorporate it with saturation and ...
aman2909's user avatar
1 vote
0 answers
22 views

Lognormal distribution notation

I have a problem where there is a lognormal variate, S = LN(30, 0.33). The Matlab code specified in the text to generate 10,000 sample values for S is S=lognrnd(log(30),.33,10000,1). My question is ...
Dipsy2000's user avatar
0 votes
0 answers
25 views

Matlab - Temperature data from 18 thermocouples, each with xyz coordinates, sampled at 1Hz. How could I make an animated 3D surface plot?

I've measured the temperature evolution in a box at 18 locations using thermocouples. I have 18 columns of temperature data in excel, each row being a time step of 1 second (sampling at 1Hz). Each ...
A. Dubois's user avatar
0 votes
0 answers
46 views

How to solve an LMI feasibility problem with such an equality constraints?

My friend is now working on a simulation problem in control theory with MATLAB, where a linear matrix inequality (LMI) feasiblity problem needs to be solved at first. However, in this LMI problem, ...
Optimal's user avatar
0 votes
2 answers
73 views

How to generate all the matrices with each entry of binary values in matlab?

Obviously, there are totally $2^{m\times n}$ matrices ($m$ and $n$ is the size of the matrix). I need a command to generate all of them. Example: for a $1\times 2$ matrix, there are all $4$ possible ...
Liming Yuan's user avatar
0 votes
0 answers
10 views

Different step sizes for each feature in a multiple linear regression

I am trying to learn multiple linear regression using MATLAB. I am using Weight (x1) and Horsepower (x2) as features to predict the mileage (y) of the vehicle. So, the model would be $y_{est}= w_1x_1+...
wanderer's user avatar
  • 105
0 votes
1 answer
80 views

Fitted $1/x$ by a linear combination of $e^x, \sin(x)$ and gamma function $\Gamma(x)$.

I am working on my homework, which is exercise 11.2b) from "Numerical Linear Algebra" by Trefethen. The exercise asks me to fit a function $f(x) = \dfrac{1}{x}$ by a linear combination of ...
hxllearnmath's user avatar
1 vote
0 answers
36 views

Pose matrices and robotics 2D movement

I have a robot starting from the origin. It first turns 90 degrees (yaw), then move to (5,10), then it starts to move along its own negative x direction at each step with a translation of 1. Here is ...
Nick X Tsui's user avatar
0 votes
0 answers
115 views

How to calculate (numerically) the convergence path to a saddle point

Imagine the following dynamic system, characterized by two stable equilibria (A and B) and an internal saddle point (C) separating its two basins of attraction of A and B. clear all syms x y a b c d ...
Alessandro's user avatar
0 votes
1 answer
72 views

Solutions and graphs of partial integro differential equations

Consider $$\partial_tu+ \partial_xu-D\partial_{yy}u=0,$$ subject to the initial condition $u(x,y,0) = v(x,y)$ and the boundary conditions at the infinities, $ u(0,0,t) = u(\pm\infty,\pm\infty,t) = 0,$ ...
Ola's user avatar
  • 23
2 votes
1 answer
106 views

Projecting a hypercube onto a hyperplane

This task involves projecting a 4-dimensional hypercube onto a hyperplane (ie a 3-dimensional space). Let the hypercube have its vertices at the points (±1, ±1, ±1, ±1), where all 16 vertices are ...
bob's user avatar
  • 23
3 votes
1 answer
109 views

How do I find Nash Equilibria if I have Payoff functions instead of Payoff Matrix in MATLAB?

I am trying to implement the noncooperative game theory in my problem, where I framed two objective functions $J_1$ and $J_2$ for maximizing the power. I plotted the $ P_1$ and $P_2$ in MATLAB as ...
aman2909's user avatar
0 votes
1 answer
66 views

MATLAB: The solution of a system of two equations with two unknowns, it gives a strange output

I give matlab a a system of two equations with two unknowns: $e_1$ and $e_2$. It solves it but in return gives two expressions, each as an $6x1$ sym, of the following form: $ e_1 = \begin{array}{c} \...
autodidacti's user avatar
1 vote
1 answer
77 views

Can I use the least square fitting to obtain a real solution of a complex equation?

I am trying to solve the following equation: $$\omega^{1/3} = p_l \omega_l^{1/3} + (1-p_l)\omega_{\omega}^{1/3} \tag{1}$$ $\omega$, $\omega_l$, and $\omega_w$ are complex numbers and $p_l$ must be ...
user7077252's user avatar
0 votes
1 answer
158 views

Linearized model of a nonlinear dynamic system

I have following dynamic system $$ \frac{\mathrm{d}v_C}{\mathrm{d}t} = -\frac{1}{R_b\cdot C}\cdot v_C\cdot\alpha, $$ where $v_C$ is the system state and output, $\alpha$ is the system input and $R_b, ...
Steve's user avatar
  • 295
0 votes
0 answers
26 views

How to make a scatter matrix of two vectors

Assume that you having two vectors $x \in \Re^n$ and $y \in \Re^n$ and you want to create matrix $X \in \Re^{n x n}$. The element of the matrix can be accessed from $X(i, j) = x_{x,j}$ coordinates, so ...
euraad's user avatar
  • 2,962

1
2 3 4 5
64