MATLAB is a high-level language and interactive programming environment for numerical computation and visualization developed by MathWorks. MATLAB can be used when performing tasks such as signal processing and communications, image and video processing, computational finance, and computational ... ...

learn more… | top users | synonyms

-1
votes
0answers
15 views

matlab code for finite volume method

I am trying to write a matlab code which is about applying Roe linearization to the 1D shallow water equation. In addition, I should include entropy fix. This is a function that I defined: function ...
1
vote
0answers
18 views

Matlab code for generating rank deficient random matrix of order $m\times n$

I am trying to make matlab code for generating rank deficient random matrix of order $m\times n$, $m > n$. Rank deficient matrix: Here $m\times n$, $m > n$ matrix $A$ would be rank deficient if ...
1
vote
0answers
12 views

Blow-up from PDE or aliasing error? How to know and check?

I have this PDE: $u_{t}= u_{xx}+g(t)\cdot u_{x}^{2}$ (with periodic boundary conditions in the interval $(-\pi,\pi)$) that I don't have an exact solution for or know if it blows up. However, by ...
0
votes
0answers
6 views

Testing an SR1 update for approximate Hessian

I have written a function in MATLAB to run an SR1 update for an iteration of a Trust Region method to find a new approximate Hessian and its inverse, but I need to test it to check it works. Are ...
0
votes
0answers
7 views

data enterpolation with fourier

I was recently started studying fourier in remote sensing area. In matlab a fast fourier translation can be done by fft function. Here it is explained with an example. In the example of astroid path ...
3
votes
3answers
92 views

Solving Viscous Burgers using spectral method

I am trying to solve the Viscous Burgers equation using the spectral method. $$u_t+uu_x = Du_{xx}$$ where $D$ is a constant (chosen to be zero) and with the initial condition $$u(x,0) = ...
-1
votes
1answer
24 views

How to plot figure on specific time on Matlab [closed]

I am trying to plot the temperature over time($t=30$) but I want to exclude the transient initial which start from $0$ to $3$. I code in Matlab like this ...
0
votes
2answers
14 views

do math operation on two arrays of different sizes

so I'm trying to find the minimum distance between each point in a large array with that of a smaller array. The following works for a single point. ...
0
votes
0answers
18 views

Applying rotation matrix on inclined plane

I want to rotate an inclined plane to a flat surface. I think I can use the Euler angles to perform this operation. Using following points (Matlab): ...
0
votes
0answers
24 views

Matlab code for autocorrelation function for stock logreturn data.

I have one vector of T logreturn times and h lags between them. I want to estimate the autocorrelation by the function attached as well as plot the obtained values argsints the lags. How do I do this ...
0
votes
2answers
32 views

How can I effectively solve linear system $Ax = b$ with some known variables

Consider system $Ax = b, x = (x_1,\ldots, x_n)^T$. Suppose that some of variable $x_i$ is known. How can I find the rest of unknown variable effectively? Assume that system has unique solutions ...
0
votes
0answers
24 views

Optimized Distance Calculation for Data Cube

I have a cube, $C$, with dimensions $n \times m \times l$. Is there a non-iterative way for calculating a distance matrix, $D_{l \times l}$, where $D_{a,b} = \|C_{a}-C_{b}\| = ...
-2
votes
0answers
28 views

Hessian Inverse

I have a problem to inverse Hessian matrix in MATLAB. What I did is I added eye(3)*1e-1 to the matrix elements, i.e., I have inv(Hessian1 + eye(3)*1e-1 ). This solved my problem and now my Hessian ...
0
votes
0answers
14 views

Solving Linear Program involving Matrix Variables

I am using Matlab to solve a Linear program which involves 3 dimensional matrices with entries X(a,b,c). Each Linear inequality/equalities involves multiple pages of the matrix X. I can always ...
2
votes
0answers
38 views

Isotonic regression like

I have 2 ordered sets $$X=\{X_1<\dots<X_n\}$$ and $$Y=\{Y_1<\dots<Y_m\}$$ with $X_1<Y_1$ and and $X_n<Y_m$. I wish to approximate an increasing continuous function $g$ by piecewise ...
1
vote
2answers
17 views

Find null space basis matlab

I want to find the basis of null space in matlab. I know that I can find it by simply running ns = null(A,'R') or Z = null(A) ...
0
votes
0answers
11 views

Why this pulse Fourier Series MATLAB code is wrong?

I try to create a MATLAB script that plots a Fourier Series of a pulse of width d and period T. ...
0
votes
0answers
11 views

Scaling vector-valued objective function for non-linear optimization/minimization

I am trying to minimize a non-linear vector-valued function in MATLAB. As a test case for my code, I try to minimize a function whose solution I know apriori. The problem is that one of the solutions ...
1
vote
1answer
36 views

MATLAB “back slash” computation [closed]

I am looking at a MATLAB code that times the backslash operator for several cases. I will list the cases below: Note: all of these are for m = 5000 1) Z = randn(m,m); A = Z'*Z; b = randn(m,1); tic; ...
2
votes
0answers
30 views

LU Decomposition vs. QR Decomposition for similar problems

Suppose I want to solve the 2D Poisson equation with Neumann boundary conditions. The solution is non-unique up to an additive constant. I have previously asked a related question here for the 1D ...
1
vote
2answers
63 views

Monte Carlo Simulation- Simulating Sum of a DICE. Matlab CODE.

Hello everyone, I try to solve the following problem: Use Monte Carlo simulation to approximate the sum of the 100 consecutive rolls of a fair die. My work in math lab is: ...
0
votes
1answer
37 views

Define a function that is a product of two previously defined functions

New to matlab and having difficulty with the syntax since im used to using mathematica. In mathematica i can define two functions $f(x)=x$ and $g(x)=x^2$ and define a third function simply as ...
2
votes
0answers
29 views

Computing large integers with matlab.

I want to compute the collatz sequence $(n,T(n),T^2(n),\dots)$ for $$n= 100\cdot \left \lfloor {\pi \cdot 10^{35}}\right \rfloor$$ with $$T(n) = \begin{cases} \frac{3n + 1}{2} & \text{ if $n$ ...
0
votes
1answer
18 views

How do I fit the coefficients of a system of ODEs to a set of empirical data using MATLAB?

I have a system of ODEs that contains 3 unknown parameters that have to be optimised in order to fit the system to a given data set. This is the system of ODEs that I have: $\frac{dP}{dt} = -\alpha ...
0
votes
0answers
21 views

Help needed with an integration problem.

I need to compute the following \begin{equation} J(\sigma) = 1-{\int_{-\infty}^{+\infty} \frac{e^{-(\xi-\sigma^2/2)^2/2\sigma^2}}{\sqrt{2\pi}\sigma}\log [1+e^\xi]d\xi} \tag{*} \end{equation} where ...
0
votes
0answers
32 views

solve 3D curve in matlab

I have three arrays : TA TB Time [1:10] And here is a plot of my datas using cftool In order to estimate the coordinates at t=20 ,i thought that i have to :project the 3d curve to plane ...
0
votes
0answers
16 views

Number of clusters in $k$-means clustering for higher-dimensional data.

I've read the Wikipedia article and a lot of posts on stackexchange (like this really thorough one) on determining the number of clusters in a data set. Based on that, I am currently using the ...
1
vote
1answer
36 views

Quasi Monte Carlo or Gaussian Hermite quadrature for a statistical model with random effect

In my likelihood function, I need to integrate a random effect out as follows $$\int g(x,c)\exp(-c^2/2)dc .$$ Since the likelihood function is really complicated, I need the approximation to be fast ...
1
vote
1answer
61 views

Can someone explain the picture to this function for me?

I'm a first year maths undergrad and in my many hours of procrastination before revision, I was playing around in MATLAB when I ended up plotting this function: ...
1
vote
0answers
20 views

Symbolic Constrained Optimization in Matlab or Mathematica

I hope you are having a nice day. I am learning MATLAB at the moment and the best way for me to learn is to use it to tackle some of my problems. I am currently trying to solve the following problem ...
0
votes
2answers
42 views

Matlab Newton-Raphson for x-tan(x)

For the function $f(x)=x-tan(x)$ I am trying to find the 3 smallest roots to six decimal places. Attempt: We need to use an iterative method to solve this problem, and I choose to use Newton-Raphson ...
0
votes
1answer
24 views

Minimization problem in MATLAB

I have this known matrix B with 9 columns and 30 rows. I am then suppose to minimize the following problem with respect to h in MATLAB, but I really don't know how to do it: $min ||B*h||_2^2$, where ...
0
votes
1answer
37 views

Runge-Kutta time step effects solution in matlab simulation

I am simulating a rocket launch using Runge-Kutta. I am trying to compute the max altitude of the rocket. When I use a different timestep I get different results. $dt = 0.1$ gives $altitude = ...
0
votes
0answers
37 views

Convolutional codes in matlab

I'm trying to construct a convolutional code in Matlab and encode some random data. However the length of the codeword are not as expected. This is the problem information: ...
0
votes
1answer
20 views

Matrix factorization by a full row rank matrix in MATLAB

I stumbled upon the following in a robotics paper I am studying: Let $J$ be a non full row rank matrix. Let $P$ be a permutation matrix, $J_0$ a full row rank matrix and $x$ a matrix such that $$J=P ...
1
vote
2answers
43 views

Numerical Computation Matlab

I am trying to solve the fifty problems $f_i(\theta) = 0, \ i = 1, ..., 50,$ where $$f_i (\theta) = \theta - \sin(\theta) - \frac{i}{100}$$ I was told I must solve these in ascending order of $i$ ...
0
votes
1answer
111 views

Can we say something about the rows of the null space matrix

I have $x_1=Mx_2$ where $x_1\in\mathbb{C}^{q\times1}$, $M\in\mathbb{C}^{q\times p}$ and $x\in\mathbb{C}^{p\times1}$. Then we have $M:\mathbb{C}^{p}\longrightarrow \rm{Range}(M)$ and we know that ...
1
vote
0answers
31 views

Unable to reproduce this figure

I was looking at an article in which I found this :. I tried to reproduce this figure but I did not find the same thing at all. I am wondering whether this would actually be the contour plot of $\log ...
0
votes
0answers
11 views

Determining eigenvalues of a differential or integral operator in Matlab?

Say I have a differential operator such as $L[\phi] = \frac{\partial \phi}{\partial x}$, or $L = \Delta \phi$, or an integral operator such as $L[\phi](x) = \int_{\partial D} \log(x - y) \phi(y) ...
4
votes
2answers
56 views

Numerical Differentiation Matlab

I am trying to estimate the second derivative of $\sin(x)$ at $0.4$ for $h=10^{-k}, \ \ k=1, 2, ..., 20$ using: $$\frac{f(x+h)-2f(x)+f(x-h)}{h^2}\tag{1}$$ And then plot the error as a function of ...
0
votes
0answers
21 views

Creating a balanced bidirectional pulse pair, also called the Lilly Wave and change it's sample amounts in octave / matlab

I was told this should be in the mathematical stackexchange Original question link below ...
2
votes
1answer
58 views

Projection Matrix onto null space of a vector

I have a vector summation $x_1 + Ax_2$ where $x_1\in\mathbb{R}^{n\times1}$, $A\in\mathbb{R}^{n\times m}$ and $x_2\in\mathbb{R}^{m\times1}$. I am wondering if I can find a projection ...
0
votes
0answers
32 views

Plotting Particular Solutions to an ODE in MATLAB

I have the ODE $$dy - (y^{2}\sin(x))dx = 0$$ I have found the general solution of this (by transforming it into an exact equation and solving) to be $$y=\frac{1}{\cos(x)+c}$$ if $\cos(x)\neq c$. If I ...
1
vote
0answers
21 views

How to perform a quasiconvex optimization

I have a quasiconvex objective function $f:\mathbf{R}^n\rightarrow \mathbf{R}$ which I would like to minimize over a simplex $S\subseteq \mathbf{R}^n$. I have looked pretty hard but have been unable ...
0
votes
2answers
29 views

Get any $3$ points in a plane from normal and one point

I know how to get the normal of a plane from any 3 points, how can I do the inverse? Suppose any $3$ points on the plane: $p_1$, $p_2$ ,$p_3$ We can get the vectors: $v_1 = p_2-p_1$,$v_2 =p_3-p_1$ ...
0
votes
0answers
17 views

I downloaded the SPARCO package (MATLAB)and when setting it up a problem has occured

I downloaded SPARCO1.2 (MATLAB) from http://www.cs.ubc.ca/labs/scl/sparco/ and when I use the command 'sparcoSetup' it says everything is successful. But then when I use the command 'checkProblems' ...
0
votes
0answers
19 views

Numerically solving a system of linear 2nd order differential equations

Background I am working on a project for differential equations, and I need to demonstrate to the professor that I am capable of 1) learning new techniques on my own and 2) implementing those ...
0
votes
1answer
24 views

Help with Legendre Plot Matlab

I've written a code to change a Chebyshev into a Legendre Polynomial, however it will not plot the graph after and I'm not sure why the graph will not plot? The code i have is: function ...
0
votes
0answers
13 views

Optimization with an non-linear ODE constraint

I want to optimize (minimize) such a cost function: $$\min_{x_1, x_2, \ldots, x_t} \left(\sum^t_{k=1} (y_k - \theta_k)\right)$$ where $\theta_k$ is some pre-defined constant and $dy/dt = f(x)$. You ...
0
votes
2answers
61 views

How can I solve this 2nd-order, non-linear, stiff ODE numerically using Matlab? [closed]

I need to find a numerical solution for $T(x)$ to \begin{equation} aT'' - bT^4 + c = 0, \ \ \ T(0) = T_0, \ \ \ T'(L) = 0 \end{equation} where $a$, $b$, $c$, $T_0$ and $L$ are positive constants. ...