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
6 views

Calculate all lines through a pixel

I have a project I am working on in which I am working with the rho-theta line equation from the Hough Transform (in which theta is the angle from the origin and rho is a value in which rho = xcos(...
0
votes
0answers
20 views

confusion in partial fraction

I have to find partial fraction of given signal $X=[s^3-2s^2-5s+6 ] / [s^2-s+2] $ for this i am working with following MATLAB code: ...
-1
votes
0answers
25 views

Get the equation of the plot of the response of the transfer function

In the case of permanent magnet DC motor position control, I wanted to rotate my motor shaft along a reference trajectory. Then I designed a piecewise function for reference and simulated the response ...
0
votes
0answers
16 views

Solve differential equation of piecewise function Matlab.

I have a piecewise function called $y(x)$ and another function called $v(x)$ which is a derivative of $y(t)$. Now I need to solve this function and plot in Matlab. To do this I've used this code and ...
0
votes
0answers
26 views

transform second-order pde into two first-order pde

I need to transform my equation into two first-order equation. But I don't know how to do that. My equation is the Gibbons-Tsarev equation : \begin{equation} \frac{\partial u}{\partial t}\frac{\...
0
votes
0answers
12 views

Singular matrix M decomposition

In Solving Ordinary Differential Equations II - Stiff and Differential-Algebraic Problems on page 378 the following is stated (paraphrased) Let M be a singular matrix. We decompose the matrix M (e.g....
1
vote
0answers
9 views

Perform principle component analysis to compute a normalcy index. Understand most but need clarification for some steps.

I know how to do PCA but I am using formula's off a particular scientific paper and replicating them in MATLAB, and also having trouble understanding them. This is the paper. The notation I use is ...
0
votes
0answers
10 views

Image Stitching using Homography Matrix

I'm currently working on an assignment where I have to take two images of the same object taken at different angles and stitch them to create a panorama - image mosaicing. I have already computed the ...
2
votes
3answers
32 views

Plot graph using maple or matlab

I have tried using maple and matlab to plot this question but it seems to be unable to plot, would to ask if there is any ideas on plotting this question using maple or matlab?
1
vote
0answers
19 views

How do I solve the eigenvalue problem by matlab

My question is how to solve the eigenvalue equation $$(\frac{d^2}{dx^2}+\frac{d^2}{dy^2})u(x,y)+b\frac{d}{dx}u(x,y)+c\frac{d}{dy}u(x,y)+sin(x) cos(y)u(x,y)=\lambda u(x,y)$$ with periodic boundary ...
0
votes
0answers
11 views

Convolution of two dependent distributions in MATLAB

Assume that I have two discrete random variables $X$ and $Y$. $X = {1,3,3,5,7,7,7,9,9,9,9,9}$ and $Y = {5,5,9,9,10,12,13}$ Where their empirical CDFs are given as: $F_x(1) = 0.0833, F_x(3) = 0.25,...
0
votes
0answers
17 views

(Lipschitz norm '). Help.

Someone knows how to implement the ∥⋅ ∥ _Lip' (Lipschitz norm ') in Matlab? It's quite difficult, I know that there is a relation between the ∥⋅ ∥ _Lip' and ...
-1
votes
0answers
9 views

How to Create a Homography Matrix in Matlab from n Pairs of Points?

I'm trying to create a homography matrix using the procedure shown below within Matlab: However, I'm having trouble actually coding it. I don't want to use SVD if possible and I'm not allowed to use ...
1
vote
2answers
25 views

Polar plot $r = 1-2\cos(6\theta)$

I have a task for school and we need to plot a polar function with MATLAB. The function is $r = 1-2\cos(6\theta)$. I did this and I'm getting exactly the same as on Wolfram Alpha: https://www....
0
votes
0answers
16 views

Stochastic Paths

I am stuck in generating stochastic paths to the differential equation \begin{equation*} \begin{split} \frac{dx}{dt}&=(b-d)x\\ x(0)&=x_0 \end{split} \end{equation*} Whose stochastic ...
0
votes
1answer
27 views

Simulation of SDE

I need to write down a code to simulate an SDE of the following type: $$ dX_t = - ( \eta_t X_t + \chi_t ) dt + \sigma dW_t, \ X_0=v_0 \quad t \in [0,T] $$ where $\eta_t$ is a deterministic function, ...
0
votes
0answers
14 views

How exactly to interpret the output of this MatLab\Octave function calculating the value of a sigmoid function?

I am studying a ML course on Coursera and I am pulling out some old linear algebra concept that I am not using since the time of university. I have some doubts. I have this MatLab\Octave function ...
0
votes
1answer
11 views

Matlab plot 2D p-norm

I want to plot the p-norm in a 2 dimensional space with the condition $|x,y|_p = 1$ ...
0
votes
0answers
26 views

How can I solve A and B must be floating-point scalars error in triple integration using Matlab [closed]

I try to perform the following integration. However, there is an error A and B must be floating-point scalars error ...
0
votes
0answers
17 views

Probability mass of a source of L symbols

I am trying to get a list of probabilities to test a function that computes the mutual information of an information channel. I have this function in Matlab ...
0
votes
1answer
22 views

Transform product into Symprod implementation

Heyhey, I would like to transform the following equation for $x=(x_1,\dots, x_d)$ into a efficient matlab code: $\begin{align}f(x) = p(e^x) \prod_{k=1}^d \varphi_{l_k,i_k}(x_k) \end{align} $ ...
0
votes
2answers
83 views

Matlab numerical solving of a Second order Ode

On matlab I want to solve numerically and plot this ode on $x\in [0,1]$ $$ g''(x)h(x)+g(x)(1-g(x)) = 0 $$ With (assume the 2 conditions) $a,b\in \mathbb R,\ g(0.5)=a$ and $g'(0.5)=b$ and where $h$ is ...
0
votes
0answers
22 views

Determination of Weights for Hierarchical Sparse Girds Quadrature

For the solving a $d$-dimensional SDE with a sparse grid algorithm related to an option pricing problem I ended up having to solve the following integral equation. $g_{\bar{l},\bar{i}} = \int_D p(e^{...
1
vote
2answers
84 views

How to solve a system of nonlinear equations containing logarithm

I need to solve the following system of equations for $x_1,x_2,x_3,x_4,x_5,x_6$ $$x_1= 0.64\times x_2 + 0.64\times x_3$$ $$x_5\times (x_2)^2= 0.392 - 1.25\times x_4 \times (x_1)^2$$ $$x_5\times(x_2)^2=...
0
votes
0answers
16 views

Converting 1-D Fixed point iterator into n-D in Matlab

I wrote a function, which takes as input an iteration function, a starting value, an error tolerance, and a maximum number of iterations. The output is the final value, whether the error bound was ...
1
vote
2answers
52 views

Least Squares with equality and inequality constraints

Could someone kindly suggest a method of solving the following constrained (equality and inequality) system of equations in the least squares fashion? $$\min_x\frac 12\|Ax-b\|_2^2$$ such that $$\...
0
votes
0answers
20 views

Integration by interpolation matlab

Hi I would like to write a program for integration in Matlab using the interpolation coefficients from piecewise Lagrange interpolation: $$\int f dx = \sum \frac{c_i}{n+1-i}(x-m)^{n+1-i}$$ This is ...
0
votes
0answers
21 views

MATLAB/EXCEL Inverse Cumulative Distribution Function (ICDF) for Negative Binomial Distribution

I have some old MATLAB code that uses the ICDF() function call (inverse cumulative distribution function). I need to translate the following into an equivalent ...
1
vote
0answers
26 views

Why MATLAB uses log base 2 instead of natural log to calculate entropy and what is the difference?

0 I write my thesis on the topic of texture analysis and with the help of MATLAB I made some calculations, including on entropy. In the explanation of the formulas, I used the entropy formula used by ...
0
votes
0answers
27 views

QR decomposition and matrix dimensions

How does the time for qr depend on matrix dimensions $m$ and $n$ of $A$ ($A \in \mathbb R^{m×n}$? I tried to test the computational time in MATLAB using ...
1
vote
1answer
53 views

Computational cost of finding only the eigenvalues

I have read that the computational cost of full eigendecomposition (finding both eigenvalues and eigenvectors) is $O(n^3)$. But what is the cost if we want to find only eigenvalues? How does MATLAB ...
0
votes
0answers
23 views

Computational time of qr, svd and eig in MATLAB?

How does the time for qr depend on the dimensions of the matrix m and n (does it depend on on the type of linear systems: overdetermined and underdetermined?) How about svd and eig? Does the time ...
0
votes
0answers
14 views

Help with ICC calculations

I am using this code to calculate the ICC for some measurements I have. The data are foot measurements (length, width, etc). I have taken about 15 measurements of 3 people for these different lengths. ...
1
vote
0answers
21 views

MATLAB - Least Squares Fitting for Log - Log Data to find p value.

This is part of the code for a random-walk simulation. To test the code, I'm using steps=[30]; there will be more values, but I want to run it for 1 trial to decrease code processing. ...
0
votes
0answers
8 views

MonteCarlo Random Walk Simulation - steps should be scaled by tmp ? (MATLAB)

I have a question regarding this code snippet that we changed for project 3 Monte-Carlo & Random Walk. monte-carlo-code-segment The code was changed to process all the stepNs. it loops through a ...
0
votes
0answers
11 views

Random Walk Modeling - Log Normalization of Data (MATLAB)

Having trouble clarifying which plot correctly log-normalizes the data. 1:steps(i); is a vector of 1 -30 and is equal to the number of steps taken ...
0
votes
0answers
15 views

MATLAB - Eigenvectors not displaying using the code null(A-[eigenvalue]*eye(n));

Problem I'm attempting to do. I just have to prove a matrix is diagonalizable. I've been following my book's steps for this, and need to create eigenvectors. Unfortunately, only one eigenvector is ...
1
vote
0answers
21 views

Sine-wave phase-dependent event?

A sinusoidal wave with frequency $f$, angular frequency $\omega = 2 \pi f$, amplitude $A$ and phase $\phi$ is of the form: $$A \sin(\omega x + \phi)$$ an example with in MATLAB: ...
0
votes
0answers
20 views

Add non-homogeneous term to heat equation in Matlab

I have this code which solves the heat equation with non homogeneous boundary conditons: $$u_t=ku_{xx}$$ where k is the diffusion coefficient but now I want to add a constant which makes the equation ...
2
votes
1answer
34 views

Octave coding - How many vectors rotated by an angle is within the distance of another vector

I don't know if this is the right forum but I am trying to code a rotating vector v by an angle theta anticlockwise ...
0
votes
0answers
20 views

Looking for an Energy-related problem can be solved using Ordinary Differential Equation

I am learning MatLab and I am looking for a problem in renewable energy that I can solve using ODE through Runge-Kutta
2
votes
1answer
28 views

eigenvalue decomposition using matlab

I would like to diagnolize a rank-1 matrix using the well known eigenvalue decomposition as $\mathbf{U}^H\mathbf{A}\mathbf{U} = diag (M, 0,\cdots, 0)$, where $\mathbf{A}$ is a Hermitian matrix and $\...
0
votes
0answers
12 views

Calculating a matrix-vector product efficiently without inverse operation

Given a matrix $A=I+K^{-1}BB^TK^{-1}$ where K is a discrete Laplacian, and B is a sparse uniformly distributed random matrix, how can I calculate matrix-vector products $Av$ efficiently without any ...
0
votes
0answers
11 views

Errors in user-made HMM, Hidden Markov Model in MATLAB

This is my code from scratch. It is an attempt to make an HMM, but there must be serious errors in my logic and code. I need to observe the sequence of states and the sequence of observed, but I ...
0
votes
1answer
33 views

Probability of random walk in a specific point - 2D Random Walk -

I've written a simulation in matlab of a 2-D random walk that, at any point, has an equal probability of going to any of the adjacent points. The simulation was run for 10,000 steps on a grid with ...
3
votes
1answer
95 views

Inviscid Burgers equation with trapezoidal boundary data

Im trying to solve $v_t + vv_x = 0$ subject to $$ v(x,0) = \begin{cases} 0, & 0 \leq x \leq 1 \\ x -1, & 1 \leq x < 2 \\ 1, & 2 \leq x \leq 3 \\ 4 - x, & 3 \leq x \leq 4 \\ 0, &...
0
votes
0answers
21 views

Projection of a circle via Matlab

I am currently stuck at this exercise - I dont know where to begin, which forumals should I use :/ You have to implement the projection of a circle as viewed by a camera in 3D with different angles ...
0
votes
1answer
41 views

Matlab code for creating the function [closed]

Matlab code for creating the function $y:[-10,10] \rightarrow \mathbb R$ defined by $$y(x)=\left\{\begin{array}{ll}0 & x \leq -10^{-6}\\ x+10 x^9& -10^{-6}<x< 10^{-6}\\ x&x \geq 10^{-...
0
votes
0answers
18 views

Censored data maximum likelihood using matlab

I am trying to minimise a likelihood function and estimate the parameter value of $λ$ by fitting to the following data. $t$ is the time and $N(t)$ is the population measured at those specific time ...
1
vote
0answers
24 views

Handling singular matrices in gradient-descent optimization.

Right now I am coding up optimization for a 70 dimension nonlinear optimization, where the analytical gradient is unavailable. I have some non-linear constraints that maps the structural parameters ...