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

0
votes
0answers
6 views

Programming the Nth element of the sequence

The sequence is defined by $$ x_0 = 1 $$ $$ x_n = {1 + x_{n-1}}^{0.5} $$ I am trying to find out the limit to the nth integer but for some reason my x_1 value does not carry to the third element. ...
-2
votes
1answer
23 views

Matlab to solve the equation

Question 1 Use Newton's method in Matlab or Octave to solve the equation $$f(x) = \frac{1}{x}+\ln x - 2 = 0$$ for $x>0$. Characterize the convergence as linear or quadratic by tabulating the ...
2
votes
0answers
21 views

why does matlab give me a negative number?

I have the following problem A steel company has four different types of scrap metal (called Typ-1 to Typ-4) with the following compositions per unit of volume They need to determine the volumes ...
1
vote
1answer
24 views

Integer programming in MATLAB - all different solutions [on hold]

I have a relatively simple minimisation problem. I have to minimise a linear function with many variables (more than 20), and I would like all the solutions to be different and in set $ x \in ...
1
vote
0answers
11 views

Quadratic programing problem and MATLAB

I have a little problem with quadratic programing problem: ${\bf v}^T \Sigma {\bf v} \rightarrow min $, and constrains are $ {\bf v}^T \mu = \mu_*, {\bf v}^T {\bf 1 }= 1, 0 \leq {\bf v}. $ Where ...
0
votes
1answer
27 views

Relating regression to projection?

I recently learned that one can think of regression as a projection of a vector in a high dimension space onto the other vector. I tried implementing this and got it to work: ...
0
votes
0answers
37 views

Solving equation using Newton's Method

Use Newton's method to solve the equation $$f(x)=\frac{1}{x}+\ln{x}-2=0$$ for $x>0$. Characterize the convergence as linear or quadratic by tabulating the number of correct bits at each step of the ...
0
votes
0answers
20 views

If and Else of time in Matlab [on hold]

I just want to ask a matlab code (if-else statement) of time. Example is if 7AM-5PM output is 1 .. the rest would have an output of 0. Thanks
-1
votes
0answers
17 views

Matlab code date and time controller [on hold]

I am struggling a lot in making the code for my controller. I successfully made the code wherein the input is the time and day of what my computer has but what I need next will be the controller in ...
0
votes
1answer
22 views

Failed attempts at fitting nonlinear Hill function (biochemistry) to data

I am trying to fit some data in Matlab to a Hill function of the form $y = \dfrac{1}{1+(K/r)^n}.$ I have data for $r,y$ and I need to find $K,n$. I have tried following the approach shown here in ...
0
votes
1answer
15 views

Matlab: function gradient and Hessian in the same function

Implement a Matlab function for computation of $ f(x),\nabla f(x),\nabla^2 f(x) $ The function must have the interface: function [f,df,d2f] = FunEx1(x) where $f(x)=f=x^2-2x+3xy+4y^3;$ I tried: ...
0
votes
1answer
15 views

Logspace() in Matlab [closed]

In Matlab , Logspace() Generate logarithmically spaced vector . But what do we mean by them ? Earlier , I used to think that they are just equal spaced and their 10th power is returned . Like here : ...
1
vote
1answer
22 views

Accelerating linear solve in MATLAB for a specific type of matrices

Inside a DG solver (so far 1D) I need to solve a linear system of equations multiple times. The order of the system is rather small ($N=10..20$). I need to solve the system $Ax=b$, where $A$ is the ...
-1
votes
1answer
28 views

Solving linear equations in Matlab

I am trying to solve the problem $Ac = b$ but I am having difficulty figuring out how to set it up. I thought multiplying by ${\rm e}$ would remove the $\ln$ but I guess I forgot my basic math. My ...
0
votes
2answers
30 views

What does this matrix operation mean in MATLAB: X\y [closed]

I'm reading somebody's code and I'm trying to figure out what this line means X\y where X is a 100x2 matrix and y is a 100x1 vector
0
votes
0answers
5 views

isotropic volume from 3D dicom data

Iam working with CTA volume having dimensions 512*512*304. How I can convert the volume into isotropic form having axial size of 256*256.I have gone through ...
0
votes
0answers
29 views

Coding a bisection algorithm using matlab (numerical analysis)

To code the bisection algorithm. We assume that f at the two end-points a and b are of different signs. We will return the approximated solution when $b_{n}$ − $a_{n}$ < 2ε or when we have found ...
0
votes
1answer
27 views

Overflow an integer sequence at a given value

Sorry, the question seems to be extremely simple, but I fail to find an answer. I have an integer sequence 1, 2, 3, ... 8 I would like to convert it to ...
0
votes
0answers
12 views

Getting confidence interval from wblfitc matlab function

I am using the matlab function wblfitc which can be found here: http://www.mathworks.com/matlabcentral/fileexchange/38226-fit-distributions-to-censored-data It gives me an estimation for the ...
0
votes
0answers
8 views

Lax-Wendroff: Computing $\partial_{t}^{3}u$ given $u_{t}=a_{1}u_{xx}+a_{2}g(t)u_{x}^{2}$

I want to use the Lax-Wendroff method to $u_{t}=a_{1}u_{xx}+a_{2}g(t)u_{x}^{2}$, for g smooth function and $a_{i}$ constants. . That requires computing $u_{ttt}$ in terms of derivatives in x. Is ...
0
votes
0answers
15 views

solving byp system in matlab

I have problem to solve this in MATLAB. The equation already in first order system, yet I still confused to write the code and solve it. Or this equation cant be solved by using bvp4c perhaps? ...
0
votes
0answers
20 views

Solving Hyperbolic PDE using MATLAB (finite difference Method)

I am given the PDE $u_t + u_x = 0, x \in (-2,3), t > 0$ with initial condition $ u(x,0) = 1 - |x|$ when $|x| \leq 1$ and $u(x,0) = 0$ when $|x| \geq 1$. With boundary condition $u(-2,t) = 0$. How ...
0
votes
0answers
19 views

Finite difference scheme for piecewise domain heat equation

We have piecewise heat equation $u_{t}(x,t)=\left\{\begin{matrix} D_{1}u_{xx}(x,t) &x\in(0,1) \\ D_{2}u_{xx}(x,t) & x\in (1,2)\end{matrix}\right.$, with IC: $u(x,0)=2x+1$ and BC : ...
0
votes
0answers
19 views

Least n for which a family of vectors is linearly dependent

I want to code in MATLAB a function find the least integer $n$ for which a family of vectors are independent. $T$ is a linear operator, $v$ is a vector in $\mathcal{H}$. The family in question is ...
1
vote
2answers
58 views

Exponential Integral difference between Maple and Matlab

I try to calculate this exponential integral: $$\int_0^1 \exp(\exp(-s))ds.$$ I obtained different results in Maple: and Matlab: Which is correct?
0
votes
0answers
25 views

Approximating a Riccati Differential Equation/Differential equation of two variables

I am currently really struggling to solve/approximate this Riccati equation $x'(t, v) = cv(1-x(t)) + \beta x(t)(1-x(t)) - \gamma x(t)$ st. $0 < c, \gamma, x_{0} < 1$ $ 0 \leq v \leq 1$ $ 0 ...
0
votes
0answers
21 views

How to avoid NaN in this matlab computation?

I am given a bunch of log-likelihood ratios $\lambda\in(-\infty,+\infty)$. \begin{equation} \lambda = log\left(\frac{P(0)}{P(1)}\right) \end{equation} I can compute $P(0)$ and $P(1)$ from a given ...
-1
votes
1answer
24 views

How to approximate linear relationship between two timeseries? [closed]

I have two time series A and B I would like to solve for the equation in the form $$y_t = m x_t + b$$ that transforms a point $y$ at time $t$ from series $B$ to the corresponding point $x$ at time ...
0
votes
0answers
12 views

Matlab Mupad not returning ODE result

I am attempting to solve this equation (A ricatti ODE) in Mupad $x'(t) = cv(t)(1-x(t)) + \beta x(t)(1-x(t)) - \gamma x(t)$ ...
0
votes
0answers
10 views

Correlate normal shocks

I am trying to generate some random standard normal variables and correlate them In particular I want: $$ \bf Y \sim \mathcal N(0, \Sigma) $$ where $\textbf{Y} = (Y_1,\dots,Y_n)$ is the vector I ...
0
votes
1answer
23 views

Covariance matrix of a random vector

According to the documentation of Matlab regarding the function cov(): "if A is a vector of observations, then cov(A) = C is the ...
0
votes
0answers
11 views

For matlab. Is it true that by supplying analytical Jacobian and Hessian, the fsolve procedure would always converge?

For matlab, Is it true that for a system with unique solution, by supplying analytical Jacobian and Hessian, the fsolve procedure would always converge? I also wonder if supply analytical ...
0
votes
1answer
25 views

problem in solving system of equations in Matlab

please help me to find the problem. I ran the below code syms u v S = solve([2*u + v == 0, u - v == 1], [u, v]) and got the below error ...
0
votes
1answer
25 views

problem with solving a set of equations using ODE solvers in matlab

I have used matlab ode solvers to solve equations of the form: $$dy/dt=f(y,t)$$ in other words, where for instance say with an explicit Euler time stepping $$y^{n+1}=y^{n}+\Delta t f(y^n,t)$$ Is it ...
-1
votes
0answers
21 views

How to estimate a mass-spring-damper parameters in MATLAB using RLS and OLS?

Assume that we have the differential equation of a mass-spring-damper model as follows: $$m\dfrac{d^2 y}{dt^2} + c \dfrac{dy}{dt} + ky(t) = F(t)$$ where m is the mass, k the spring's stiffness ...
0
votes
0answers
15 views

C /matlab/ Algorithm for monotonicity of Ploygon

is there any easy and understand able algorithm to check the monotonicity of random polygon and also help me to code in which language(c or matlab) is beneficial to code the algorithm
0
votes
1answer
11 views

decimal to binary conversion of recurring decimal numbers in matlab

I have made a function convert fractional part of a decimal number to binary, the code is given below: ...
0
votes
0answers
9 views

Inserting “holes” on a graph.

I am trying to plot the set $A = \big\{(x,y) \in \mathbb{R}^{2} \mid x^{2} + y^{2} < 2 \big\} - \big\{(0,\frac{1}{n}) \mid n=1,2,3 \dots \big\}$. I have tried different combinations of set ...
0
votes
0answers
25 views

Fourier Transform of 1/x

I am trying to calculate the Fourier Transform of $h(x)=1/x$ So I was thinking: Since the FT of $g(x)=sign(x)$ is $G(f)=1/(i\pi f)$ , then using property of duality gives that $G(x)=1/(i\pi x)$ ...
0
votes
2answers
52 views

Simple Monte-carlo approximation of $\pi$ and integration using Matlab.

Hi I am new to programming and the following task that my tutor want me to handle was a bit to hard to begin with. I hope someone can help me and I need the code in Matlab. You are throwing darts ...
0
votes
0answers
7 views

How do I validate my ARMAX model?

Say I have some ouput $y_1, y_2, \ldots, y_N$ and inputs $x_1, x_2, \ldots, x_N$ which, by various time series methods, I've found to match an ARMAX(2,2,1) model. So I've found the estimations for ...
0
votes
1answer
113 views

Normalized objective function in optimization problem

I have fairly standard linear optimization model with two objectives \begin{align*} \text{max}\, (f_1 &= 4x_1+5 x_2\,,\,f_2 = 1x_1 + 0x_2 ) \\ \text{subject to}& \\ 1x_1 + 1x_2 ...
0
votes
1answer
33 views

Constrained optimization with alternates in special conditions

I have the following optimization problem. $$\max_{a b} acx+bdy+z \ \ \ \ \ \ $$ subjected to $$ c = \begin{cases} 1, & \text{if } 2xa-yb-z\geq 4\\ 0, & \text{if} \ 2ax<yb+z\\ ...
0
votes
0answers
19 views

nonlinear optimization : restricting search space to “limited” preselected value

My function is nonlinear with respect to a scalar \alpha . However, the calculation of objective function is very time consuming, making optimization also very time consuming. Also, I have to do it ...
0
votes
2answers
44 views

Solve system of equations using matrices

Matrix of Unknowns: $X$ Known values (constants): $A, K, F$ How to solve using any programming language: $$ AX + XA^\top + K\cdot X = F $$ (${}\cdot{}$ is element wise product )
0
votes
0answers
13 views

Input a matrix with integral element in matlab

I am working on stochastic fractional differential equation , like below $$ D^2y+D^{\frac{3}{2}}y+y=1+t ,\space y(0)=0 ,y(1)=2$$I use RBF's (radial basis function) to solve it .so $y \sim \lambda_1 ...
0
votes
0answers
15 views

Why is the square of an image not equvalent to taking the autoconvolution of an image in fourier space?

Al right I know that in order to multiply in the normal domain I have to take the convolution in Fourier domain but when I do so in matlab and invert the result then I come up with nothing but a lot ...
2
votes
1answer
51 views

Real series convergence check

$$ \sum_{n=1}^\infty \frac{n! \> x^n}{(x+1)(2x+1) \cdots (nx+1)} $$ I start with d'Alembert, $\displaystyle L= \lim_{x\to\infty} \frac{a_{n+1}}{a_n}$ it gives me: $L=x+1$, to find convergence ...
0
votes
0answers
40 views

How can I raise a sum of imaginary numbers without losing it's shape?

I try to be be a little bit more specific; I define a Gauss sum with $$G(p,q)=\sum\limits_{m=1}^{q-1}\zeta_p^j*\zeta_q^m$$ Here $\zeta_q=e^{2\pi i/q}$ and $\zeta_p=e^{2\pi i/p}$ are qth and pth ...
1
vote
1answer
21 views

Plotting 2 parameters function in MATLAB

I want to plot 2 functions in MATLAB. First one is like this: X=[0.1 0.2 0.3]; Y=[5 4 1]; plot(X,Y); and the second one that I want to plot on the last function at the same figure is ...