Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
13 views

Compute state transition matrix for discrete system

Given a discrete linear time invariant system like $$ x(k+1) = A x(k) $$ The solution at a given instant $k$ can be computed using the state transition matrix $A^k$ by $$ x(k) = A^k x(0) $$ For ...
1
vote
0answers
17 views

solving non numerical matrix in matlab

I am trying to solve R1 and R2 on this equation in Matlab. I know that all term are constant except R1 and R2. I am trying to see online tutorial but all of them so far has numerical examples (rather ...
-2
votes
0answers
18 views

zdt4 test function [on hold]

please help me to run this code in Matlab: message error :Caused by: Failure in initial fitness function evaluation. GAMULTIOBJ cannot continue. ...
0
votes
1answer
26 views

Proposed 'exact' solution for the Asian Option

https://www.researchgate.net/profile/Moawia_Alghalith/publication/331075967_Exact_Pricing_of_the_Arithmetic_Asian_Options_A_Simple_Formula/links/5c704a07a6fdcc47159419a0/Exact-Pricing-of-the-...
0
votes
0answers
21 views

Structural controllability of networks

I want to check the structural controllability of a given network from a given input node. In Matlab, controllability can be verified using Kalman rank condition (...
-2
votes
1answer
43 views

Different results for complex exponential (1-i)^500 [on hold]

I get different results for (1-i)^500 when solving it using an online complex numbers calculator and when solving it using MatLab. MatLab says it's supposed to be -1.809E75 with the imaginary part ...
0
votes
0answers
42 views

Power Series Approximation of 2-variable Function, compute coefficients

This is my first post here, I'm an undergraduate first year in engineering. We have been given a MATLAB question with a particularly troublesome part that supposes a power series (?) approximation of ...
0
votes
0answers
18 views

Find boundaries to separate peaks in a 3D plot using matlab or python

Could you tell me how to find boundaries to separate the peaks in the 3D plot below? Ideally, the boundaries are at the local minimum. Peaks can be generated using Gaussian distributions with some ...
2
votes
1answer
48 views

$-\frac13\int\sin 3t\tan 3t\,dt$

I've done $$-\frac13\int \sin 3t\tan 3t\,dt=-\frac19\ln(\sec 3t+\tan 3t)+\frac19\sin 3t$$ using standard procedures in Calculus II. However, Matlab returns $$-\frac13\int \sin 3t\tan 3t\,dt=\frac19\...
0
votes
1answer
24 views

Mapping PDE Coefficients to a Heat Storage application

I am attempting to solve a heat storage problem using Matlab and the PDE Toolbox and could use some assistance with the math portion. The task is to model a concrete thermal battery with an array of ...
1
vote
1answer
15 views

Using alternating-direction implicit method to solve nonzero boundary value problem (transform into zero boundary value problem)

$$u_t = 0.25(u_{xx}+u_{yy}) -8x(x^2+y^2), \qquad 0 \leq x,y \leq 1, \qquad 0 \leq t \leq 0.5,$$ $$u(0,y,t) = y^2 - y, \qquad u(1,y,t) = y^2 + y + 1,$$ $$u(x,0,t) = x, \qquad u(x,1,t) = 3x,$$ $$u(x,y,0)...
-1
votes
0answers
34 views

Third Order ODE block diagram

enter image description here Derive the system matrix, A, spectral matrix, S, and modal matrix, M, and hence determine the states, 𝑥1(𝑡), 𝑥2(𝑡), and 𝑥3(𝑡) in response to the initial conditions ...
0
votes
1answer
20 views

How to solve a matrix using Cholesky Decompositon on Matlab

I'm trying to solve a system of linear equations on MATLAB, I have written a code that solves the problem using Gaussian Elimination. But I was wondering how I could modify this to use other methods ...
0
votes
0answers
13 views

Discrete Minimisation using Particle Swarm Optimisation

I'm trying to find the minimum of a function z = x + y. Say that the function can ONLY have the following inputs for x & y: (10, 40), (5, 60), (10, 30), (20, 15), (10, 20), (5, 60). i.e. the ...
0
votes
0answers
8 views

Inverse Fourier analysis problem - matlab

Using MATLAB, I am trying to do an analysis of a triangular pulse and recreating it from acquired coefficients of the Fourier series. The pulse looks like this ...
1
vote
0answers
34 views
+100

Smith normal form of rectangular matrix in MATLAB

Suppose I've got a nonsquare integer matrix, say $\begin{pmatrix}3 & 1 & 1 & 1\\1 & 1 & 1 &1\end{pmatrix}$ and want to compute its Smith normal form--in this case, $\begin{...
0
votes
1answer
11 views

From randn to bivariate Gaussian distribution image

In Matlab, I generated a bivariate Gaussian distribution with mean 50 and standard deviation 50: G=50*randn((100*100)/2,2)+50; histogram2(G(:,1),G(:,2)); The 3D ...
0
votes
0answers
17 views

Newton's Interpolating Divided Difference Polynomial (MATLAB)

I'm trying to construct a polynomial in MATLAB using Newton's Interpolating Divided Difference Formula, and in doing so, generalize it to any size vector x and y. So far i was able to obtain the ...
0
votes
0answers
49 views

Loops in Matlab to solve a random walk problem

The matlab exercise states "Suppose now that you are playing the game with 100 coins (50 coins for each player to start) with a loaded dice such that the probability that the dice rolls to an even ...
0
votes
1answer
29 views

Schrödinger's Equation with square potential

I have written some code to solve and plot the time independent Schrödinger's equation with potential x^2, which has a bound state with odd integral energy eigenvalues. My code plots the graphs up to ...
0
votes
1answer
23 views

How to transform the given function to be defined in another range?

I have the following weighting function: $$ w(\rho) = k \cdot(\rho^\alpha)\cdot(1-\rho)^\beta,$$ where $\rho$ represents a pixel value expressed as a double, i.e., ...
1
vote
0answers
12 views

Getting same output dimension from the fimplicit matlab function

I am using fimplicit function to plot two implicit curves as follows: ...
0
votes
0answers
16 views

Using ode15s to solve DAE system - how to specify which variable IC to change?

I am trying to solve a DAE system with 7 ODEs and 1 algebraic constraint equation, so a total of 8 variables. I specify my initial conditions then ode15s calls <...
0
votes
1answer
29 views

Solve symbolic Sylvester-like equation in MATLAB or MAPLE

I'm looking for a way to solve a symbolic Sylvester-like equation in MATLAB or MAPLE (or any other available tool). In particular, I have the following equation, $$AX+XA=B$$ where, $A$ has some ...
2
votes
1answer
43 views

Why is this implementation of the Lax-Friedrichs scheme so dissipative?

I needed a numerical solver for the advection equation in 1D. So I decided to implement the Lax-Friedrichs scheme in Matlab like so: ...
0
votes
0answers
26 views

best way to plot the 3D shape made by many intersecting f(x,y,z) functions?

What's the best way to use a computer to plot the 3D shape made by many intersecting f(x,y,z) functions? I was trying to do something like the following, except I still have not idea what the shape ...
0
votes
2answers
105 views

Why is $0.0180 = 0.0180$ false in MATLAB? [closed]

I am trying to do a small script in MatLab. What it does is load .txt data in to memory. The data comes in a few columns, and I need it to figure out in how many. The data in the .txt will look like ...
0
votes
0answers
18 views

Direction Field in MatLab

I need to plot the direction field and phase plane of the following ODE using matlab. I've tried using meshgrid w/ the quiver function, however, I'm not getting the correct field. I need to plot $\...
0
votes
1answer
32 views

Formulating an optimization based on rank

I originally posted this question here on the SuperUser network as I'd seen suggestions that was the best place for MatLab questions, but it's not getting a lot of traction there. Independent of ...
0
votes
2answers
76 views

Simple Differential Equation in Matlab and Wolfram get two different answer?

I'm a beginner in using Matlab. if I have a DE like $$x'(t)=\frac{1}{\sin (2x)}$$ How I can Implement in Matlab to calculate just answer? I try dsolve like as: ySol(t) = dsolve(ode,cond) but ...
-2
votes
0answers
16 views

How to find the unique solution to norm(a,2)==c; when c is a scalar and a=[x abs(1/x);x+1 1/x]

I am trying to find the unique solution to the following equation using Matlab norm(a,2)=0.11 when x is a variable and a=[x abs(1/x);x+1 1/x]. b is ...
0
votes
0answers
18 views

MATLAB solving BVP using bvp4c, variable coefficient

Say I have an bvp that involve the equation below h''' = f(r)*h'' + h' If I was to have enough boundary conditions to satisfy h(r) ODE, would it be possible to solve the f(r) equation ...
0
votes
0answers
18 views

Choleskey Decomposition of a Complex Matrix in MATLAB

I am trying to decompose a cross spectral density matrix (A Complex Matrix) using "chol" command in MATLAB. we know that every positive definite and Hermitian matrix can be decomposed using Cholesky ...
0
votes
1answer
17 views

MATLAB-infinity vectors.

I start learning to use Matlab. And I don't know how to create vectors: 1) $1,1/2,1/3,1/4....$ 2) $0, 1,2, 2/3, 3/4...$
-1
votes
0answers
16 views

What is the significance of the max and min values of a inverted matrix?

so I have a lab where you have to find the inverse of a symmetrical 16 x 16 matrix, find the maximum and minimum value of the inverse using MATLAB, and describe the significance of those extreme ...
0
votes
0answers
24 views

Plotting the sum of Heaviside functions in matlab

So I'm trying to plot a function in MatLab for different values of $k$. Given $u(t)$; $u(t)=1+2\sum^{\infty}_{n=1}(-1)^{n}H(t-n)$ I am trying to plot the function $y(t)$; $y(t)=\frac{1}{k^2}\Big{(...
1
vote
1answer
31 views

Shift in Time Domain by altering Fourier-Coefficients

I want to apply a circular shift to a time-series, by changing the phase of the fourier-coefficients. But I run into trouble. In the current state the true sequence starts in the middle of the time-...
0
votes
1answer
18 views

Solving a matrix ODE in Matlab

I have a matrix equation in the form $$ \begin{bmatrix} A(x)\ \end{bmatrix}_{,x} =\frac{\begin{bmatrix} A(x)\ \end{bmatrix}^2}{\begin{bmatrix} B_o\ \end{bmatrix}} +\begin{bmatrix} A(x)\ \end{bmatrix} ...
0
votes
0answers
12 views

Gauss-Markov Mobility Model query

I have a query in understanding a little point, please if you could help me understand that. Thanks In the Gauss-Markov Mobility Model, the current speed and position are calculated based on speed ...
0
votes
0answers
50 views

Resolution complex integral with Matlab

I'm trying to solve an equation proposed by a paper. I can't integrate up to infinite cause the code gives me a warning. I am able to integrate until a value as 2000 or 3000, but the solution differs ...
-1
votes
1answer
36 views

Efficient generation (using MATLAB) of the subset of all permutations that are in alphabetical order

Suppose, for example, that I have $d=4$ dials on a lock each with $s=3$ possible settings: $a, b, c$. As shown by Ned in this post, the subset of lock permutations that are in alphabetical order in ...
0
votes
1answer
19 views

Need help understanding the following MATLAB operations for Gaussian Elimination with Partial Pivoting?

MATLAB code for Guassian Elimination with Partial Pivoting I'm having trouble understanding the following segment: ...
0
votes
1answer
47 views

Solving system of ODEs in Matlab

I am trying to code an ODE system for $n=[-2,-1,0,1]$ $\frac{dx_n}{dt}=V_nx_n-x_{n+1}-x_{n-1}$ with some IC, say $[0 ~ 0~ 0~0]$: I have also a B.C at the two ends $n=-2$ and $n=1$, which I don't ...
0
votes
0answers
23 views

Fourier( complex Number included) plot in Matlab

How can I plot this fourier transform as an amplitude spectrum in Matlab? I can plot in Matlab, but for this function I do not know how the complex function will affect my plot? Thank you $$F(w)=(10/...
0
votes
1answer
15 views

Mathematical equivalent of Matlab special case element-wise multiplication similar to Schur-product

I'm searching for the mathematical name and notation of a special case of the element-wise multiplication .* in Matlab shown in the following picture: Desired ...
0
votes
0answers
6 views

How to Access the Variable Viewer Data Programmatically

I would like to be able to record each experimental model run's configuration data. The specific data I am interested in is the block data for Simscape. I would like to store that data with run ...
0
votes
0answers
14 views

How can I implement Filtered back-projection Algorithm for Photoacoustic tomography in Matlab?

I need to implement FBP image reconstruction algorithm for Photoacoustic tomography in Matlab, but I can't. I found this paper and it has the algorithm for the discrete FBP but I'm not able to ...
0
votes
0answers
12 views

MATLAB: color scale with probplot

I have two 1D vectors of the same length, data and my_parameter. I use probplot to see the ...
0
votes
1answer
65 views

Implement recursive definition and closed form in octave

I want to find $I_n := \int_{0}^{1} x^n e^x dx$ with numerical methods. I have found the recurrence relation $I_n = e - n \cdot I_{n - 1}$ and the closed form \begin{align} \tag{$\star$} \label{eq:...
0
votes
0answers
16 views

Rounding in IEEE double precision computer arithmetic

Wanted to check whether I executed this arithmetic expression correctly: $$(1 + (2^{-51} + 2^{-52} + 2{-53})) − 1$$ My process follows: $1.[00...00]\cdot 2^{0}+0.[0...010]\cdot 2^{0}+0.[0...001]\...