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
1answer
306 views

Gaussian distribution and its parameters

I need to learn more about Gaussian distribution and given a set of data, plot a Gaussian distribution of it. Using the following code sample, could you please tell me how I can plot a Gaussian ...
1
vote
1answer
253 views

Recursive function for $a^n$ in matlab

...
1
vote
3answers
71 views

How to write this efficiently in MATLAB?

I would like to re-write this efficiently in MATLAB. n=3; x=zeros(n); y=x; for 1=1:n x(:,i)=i; y(i,:)=i; end I tried to run it in MATLAB and get this output ...
0
votes
2answers
560 views

Generate a random integer between -2 and 1 inclusive

How can one generate a random integer between -2 and 1 inclusive? I know if I take rand*(b-a)+a I would get random real number between a and b Thanks
0
votes
1answer
184 views

Matlab - Generate square convex function with positive definite Hessian Matrix

So, I have to generate a square convex function in Matlab and it's Hessian Matrix must be positive definite but I can't find any function that can help me do that. Is there anything I should search ...
0
votes
1answer
131 views

Solving a nonlinear system of differential equations in MATLAB or Mathematica

Is it possible to solve the system $$\dot{W}=A\left(k-\frac{M}{W}\right)$$ $$\dot{M}=B\left(k-\frac{M}{W}\right)$$ with initial conditions $$W(0)=w_0$$ $$M(0)=m_0$$ in MATLAB or Mathematica? If so, ...
-1
votes
2answers
38 views

How to get an n+2 column in matlab

function dy = SIR(t,y) n=100; dy=zeros(n+2,1); ...
1
vote
3answers
5k views

How to plot a phase portrait for this system of differential equations?

I beg your help.. I'd like the phase portrait for this system. I don't know how to use Mathematica/Matlab ... :( If anyone can make this portrait and post a print screen here, I would thank you ...
0
votes
1answer
65 views

Matlab help with Newton's method

I'm doing something wrong. I don't know what. I get random numbers instead of anything that converges. So, this is supposed to converge to $\sqrt{x}$ ($\sqrt{3}$ here, which is approx. $1.732$). ...
0
votes
1answer
88 views

Help with Matlab rewriting subtraction as division

I have the function 1./(1-(x).^3)-1./(1+(x).^3) I need to rewrite this function so that it works well when I plot it on Matlab on the interval ...
0
votes
1answer
34 views

The entries of a random matrix

I am confused about something. Whenever I create an $n\times n$ random matrix using Matlab (using the command $A=\mathrm{rand}(n,n)$), I get a square matrix whose entries are all between $0$ and $1$. ...
3
votes
3answers
78 views

Changing [2,4] into [0,1,0,0,0,1] in Matlab

Good day, I apologize for the very vague title, I didn't really know how to formulate what I want. However, I can explain what I mean: I have a vector v1: ...
0
votes
1answer
29 views

How to get good derivatives results in matlab?

I got the set of some points, and I need to get derivatives from it. I try to use the diff() function in matlab but, well, results kinda not ok. Is there any better ...
-5
votes
1answer
69 views

Describe the Transpose of $A= \left[\matrix{0 & 0 & 1\\0 & 1 & 1\\ 1 &1 &1} \right]$

$$A= \left[\matrix{0& 0& 0& 0& 0& 0& 0& 0& 0& 1\\ 0& 0& 0& 0& 0& 0& 0& 0& 1& 1\\ 0& 0& 0& 0& 0& 0& ...
0
votes
1answer
41 views

MATLab help involving Linear Algebra.

I am trying to understand what is happening here.. A = floor(10*rand(3)); b = sum(A')'; z = ones(3,1); If I solve the system $Ax = b$, the solution is identical ...
1
vote
2answers
312 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
170 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
92 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
147 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
50 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
281 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
91 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
72 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
481 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
65 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
816 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
128 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
133 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
153 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
100 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
143 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
3k 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
49 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
44 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
81 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
172 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
157 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
791 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
500 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
452 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
165 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
0answers
38 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, ...