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
vote
2answers
298 views

help on matlab code

I would like to display errors in case a user enters a number less or equal to 0.how can i put it? thanks Problem:Write a script areaMenu that will print a list consisting of “cylinder”, “circle”, ...
1
vote
0answers
165 views

Using Lambertw to solve $x\ln(x) = a$

I am trying to solve the equation $$ x \ln (x) = a, $$ where $x$ is a variable and $a$ is a given constant, using Matlab and the lambertw function. Not really sure exactly what to type into Matlab ...
2
votes
1answer
89 views

How to express MATLAB indexing in math notation?

I am currently writing a paper concerning discrete arrays. Given the following MATALB statement ...
0
votes
2answers
135 views

Can the singular values be plotted?

I have a set of 3 x 3 co-variance matrices that I need to plot. Using singular value decomposition (svd) in Matlab I managed to obtains a vector of singular values for each matrix as stated here. I ...
0
votes
1answer
2k views

Computing a double integral using MATLAB

I need to compute a double integral using MATLAB I'm not good at programming. I believe you just have to use this function called integral2 http://www.mathworks.com/help/matlab/ref/integral2.html But ...
0
votes
1answer
46 views

Implement ideal line search algorithm

I have the function $f(x)=\frac {1}{2} \mathbf x^T Q \mathbf x$. I want to use the steepest descent algorithm where $Q$ is the diagonal matrix $\begin{bmatrix}1 & 0\\0 & 20\end{bmatrix}$ and ...
0
votes
1answer
261 views

Matlab and lambertw function

I have Matlab 7.9.0 (R2009b) I want use the W lambert function. does someone know if Lambertw is only available to updated version of Matlab ? or if i need to do something before ? I am not very good ...
1
vote
1answer
81 views

How to approximate a smooth function

Now I have a target smooth function f which is infinitely differentiable over $R^d$, $f \in C^{\inf}(R^d)$. $f = \Sigma c_ig_i(x)$, where $c_i$s are unknown coefficients and $g_i(x)$ is a smooth ...
0
votes
1answer
71 views

converting a signal back and forth with trigonometric functions

I'm trying to convert a signal back and forth using trigonometric functions. In the example below: 1) start off with a cos signal 2) convert the signal to a secant signal 3) would like to convert ...
1
vote
2answers
467 views

Unexpected Lower Triangular Matrix given by Matlab

I was trying to find the lower triangular matrix L and upper triangular matrix U of an A matrix using the [L, U]= lu(A) command. For some reason, ...
0
votes
1answer
64 views

If normal distribution can be adapted to the set of data?

Using Matlab I need to generate a sample x of random numbers (n=30) from the normal distribution, using the command normrnd, and ...
2
votes
2answers
761 views

Finding D matrix in LDU in matlab

I have been searching the web for nearly 3 hours about a MatLab function that can take matrix A and give me back L, D, and U. ...
0
votes
1answer
121 views

MatLab updating a recursive variable.

See the code x(1) = 0; k = 1; while x(k) <=6 x(k) = x(k) +2 k = k +1; end So I want the code to output x(1) = 2 x(2) = 4 x(3) = 6 ...
0
votes
1answer
130 views

Interest Rate Tree in Matlab

I would like to calibrate a interest rate tree using the optimization tool in matlab. Need some guidance on doing it. The interest rate tree looks like this: How it works: 3.73% = 2.5%*exp(2*0.2) ...
1
vote
2answers
144 views

Graphing a function f(x,y) on a restricted set of values for (x,y)

I'm having a hard time with this certain problem. Suppose that $S=\{(x,y): x^2 + y^2\leq 4\}$ and define $f:S\rightarrow\mathbb{R}$ as $f(x,y)=-x-2y-2y^2+cos(x\pi /4)$. How can we produce a (3d) ...
1
vote
0answers
93 views

Trace minimization problem in MATLAB

objective function: $\min_{X} F(X)$ constraint : $\operatorname{trace}(CXDX^H)\ge\alpha$ where A&C&Dis a matrix of $N\times N$ and X is matrix of $N\times N$ and F(X)=trace$(AX^HX)$ how ...
1
vote
0answers
139 views

Intrinsic camera parameter from three vanishing points

I would like to recover the intrinsic parameter from three vanishing points of a digital image. I read a bit on the famous textbook Multiple View Geometry in Computer Vision (pag. 226) but I couldn't ...
0
votes
2answers
2k views

How to solve Ax=0.. with 4 unknowns and 4 linear equations

I am trying to solve 4 linear equations for a 3D triangulation problem to create a function in matlab code. I have 4 equations such as aX + bY + cZ + dW = 0 eX + fY + gZ + hW = 0 iX + jY + kZ + lW ...
0
votes
2answers
63 views

How to create an image from this function?

this is a newbie question. I would like to create an image that intensity obey to the following function g() : $$ g(x,y) = \begin{cases} -10, & x \in [-50, ...
0
votes
0answers
48 views

Best optimizer in Matlab for this problem?

I need to do yield curve extraction for fixed income. I have 10 fixed income instruments for which I have values. The method is called Nelson-Siegel Method: ...
1
vote
1answer
43 views

How to know all errors in Optimization process?

I am using fminsearch in MATLAB to iteratively find the answer of a function. But it seems like the fminsearch cannot fulfill my expectation. So I ask this question whether there is any way to do what ...
1
vote
0answers
78 views

How to minimise an objective function which is not a direct function of the decision variable?

I have a problem with partitioning a water network by closing some pipes. I use some graph theory techniques to find some candidate pipes to close; but to select which pipes among them to close (my ...
0
votes
1answer
38 views

Matlab, “tranpose(x)” not doing it right?

I just found this really weird thing in matlab, when I do x = [1 2 3]; tranpose(x)*x I don't get $14$ as an output, but I get a 3 x 3 matrix ...
0
votes
1answer
161 views

System of non-linear equations

I am trying to solve a system of non-linear equations where number of valid solutions are unbounded. I am interested in only one valid result. ...
1
vote
2answers
68 views

Reducing a two term signal to one term

I am trying to solve a phasor addition problem, reducing from its original form to $$X(t) = A \cos(\omega_0 * t + \phi)$$ The original equation is : $$X(t) = 2 \sin(\omega_0 * t + 45) + ...
1
vote
0answers
151 views

Calculate a 5x5 Vandermonde system for a 5 point mesh

This is problem 1.2 in Randall J Leveque's textbook, "Finite Di fference Methods for Ordinary and Partial Di fferential Equations". I'm struggling with how to actually do the computation, I'm not so ...
0
votes
1answer
1k views

Trapezoidal integration in matlab - code explanation

I have a simple matlab script for calculating an Integral using trapezoidal rule. The idea is calculate Fourier series, and it used for the Fourier coefficients. ...
1
vote
1answer
742 views

Converting the diffusion equation PDEs to ODEs for use in Matlab ODE solvers

I am trying to convert the diffusion equation to ODEs so that it can be programmed using Matlab's ODE solvers. The diffusion equation I'm using is: $$ {\partial u \over \partial t} = D\,{\partial^{2}u ...
1
vote
2answers
2k views

Generating a triangular matrix on MatLab with loops

I am trying to create a triangular matrix from a row vector using loops. I know there are built-in commands that makes this easy, but I am a beginner programmer and I want to test this out. Here is ...
1
vote
1answer
481 views

What's wrong in my Taylor series implementation in MATLAB?

I'm trying to code Taylor summation for a function in Matlab, I actually evaluate McLaurin making $x_0=0$, named a in this code after this notation: This is the code I've tried out so far: ...
0
votes
1answer
79 views

Dense symmetric positive definite matrix

How could one define a dense symmetric positive definite matrix (dimension $1000 \times 1000$) with uniformly distributed eigenvalues (with the smallest eigenvalue $1$ and the condition number $100$) ...
1
vote
2answers
411 views

Parametric equations and specifications of a triskelion (triple spiral)

I haven't been able to find the parametric equations and specifications to form a triskelion, a triple spiral (this is made of three interlocked couples of spirals). Using the parametric equation of ...
2
votes
3answers
2k views

draw an Ellipsoid given its quaderatic equation in Matlab

How can I draw an ellipsoid in Matlab with following equation: $aX^2 + bY^2 + cZ^2 + d XY+e XZ +f YZ +gX +hY+iZ=R^2$ with (for example) $a=1; b=2; c=3; d=4; e=5; f=6; g=7; h=8; i=9; R^2=10.$
0
votes
1answer
160 views

Plot of recurring system in MATLAB, Lozi map

I need to write this recurring system in MATLAB $$ x_{n+1}=1-a|x_n|+y_n$$ $$ y_{n+1}=bx_n $$ and take its plot for every $x_i,y_i$,with let's say a=1.4 and b=0.7. $$$$This is the Lozi map. And this ...
0
votes
1answer
53 views

Basic doubt matlab [closed]

Hi I want to evaluate a function in Matlab at some points, as an example: $for$ $i=-6\pi:\pi/10:6\pi$ $fun(j)=sin(i);$ Where I want to preallocate $fun$ like ...
0
votes
0answers
35 views

Numerical problem with set of ODEs

I have a set of ODEs: $$\dot{x}_{i} = f_i(x_1, \ldots, x_N), ~ i \in \{1, 2, \ldots, N\}$$ This set of ODE has the following properties: $\displaystyle\sum_{i=1}^N f_i = 0 ~ \forall x_1, \ldots, ...
0
votes
1answer
758 views

Standard deviation for Gaussian distribution in Matlab

I have a number of test data (400 samples) that are distributed according to the Gaussian distribution, N(0,sigma). Is there a simple way of calculating the sample standard deviation sigma for these ...
1
vote
0answers
376 views

How can I write a code for the continued fraction expansion of arctan in matlab using wallis' algorithm?

I have already written the following program using wallis' algorithm for continued fraction expansion, but when I compare it to the actual value of arctan the error is high. I thought that there was ...
0
votes
1answer
65 views

Discrete fourier transform problem

We have taken $1000$ observations from signal $s(t),t \in\Bbb{R}$ $$h(k)=s(k\Delta t+t_0),k=0,1,\dots,999,$$ where $\Delta t=1/200 $ and $t_0=-2$ (in seconds). When we calculate discrete fourier ...
0
votes
1answer
81 views

MATLAB: Approximate tomorrow's temperature with 2nd, 3rd and 4th polynomial using the Least Squares method.

The following is Exercise 3 of a Numerical Analysis task I have to do as part of my university course on the subject. Find an approximation of tomorrow's temperature based on the last 23 values ...
2
votes
0answers
69 views

Compute eigenvector using given eigenvalue

I have a fairly small matrix (cca 100x100). I have computed first four largest eigenvalues (with modified Lanczsos and Lanczsos with reorthogonalization). I know this might be a rather dumb question, ...
0
votes
1answer
101 views

Fast Ax = b solver

I have got problem finding x with this equation $Ax = b$ where my matrix $A=\mu.\Phi^T\Phi+\lambda.I$ where $\Phi$ is $m$ x $n$ Gaussian random matrix. $x,b$ is vector $n$ x $1$ where I already ...
0
votes
1answer
70 views
0
votes
1answer
259 views

How to find coordinates of point in 3D given few points

How to find coordinates of point in 3D given coordinates of few(more than 3 non linear/noncoplaner) points and distance from desired point using MATLAB? suppose given five points are: [2.6643 ...
0
votes
2answers
55 views

A basic MATLab question regarding iterations

Suppose I want to run a loop for integers $i = 2,2^2,2^3, \dots,2^n$ How would I do this? That is, suppose I want to evaluate some function f(i) through the increments $2, 2^2, 2^3$. I understand ...
0
votes
2answers
373 views

Can't read integral method [closed]

I type this : fun = @(x) exp(-x.^2).*log(x).^2; q = integral(fun,2,4); q; when I run the above code, I get an error message Undefined function or method ...
0
votes
2answers
115 views

How do you generate a surface who's value around the origin is within some range

What's a quick way to generate a smooth, closed-form surface that will be within the range $[0,1]$ for $x, y \in [-1,1]\times[-1,1]$? The surfaces should be of similar complexity to $2\times2$-degree ...
0
votes
2answers
235 views

matlab cell convert to columns

I am having difficulty with MATLAB. I have 106 columns and 1 row. Each cell in each row contains a different amount of numbers. If I type result{1} I get 7. If I type result{2}, I get 3 numbers, ...
3
votes
3answers
6k views

Understanding Fourier transform example in Matlab

I'm studying about Fourier series and transform and I get confused with the following Matlab example of Fourier transformation: ...
3
votes
2answers
753 views

Matlab code for computing index of matrix

I need help to make Matlab code for computing index of matrix. The index of matrix $A$ is the least non negative integer $k$ such that $\operatorname{rank}(A^{k+1}) = \operatorname{rank}(A^k)$. ...