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.

MATLAB (Matrix Laboratory) 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 biology. It is the foundation for a number of other tools, including Simulink and various toolboxes that extend its core capabilities.

In addition, MATLAB is a proprietary product of MathWorks. This means that, unlike other GNU GPL open source languages, both programmers and users must own a valid software license for running MATLAB code. There are several open source alternatives to MATLAB, in particular GNU Octave, which offers bidirectional syntactic compatibility with MATLAB, Scilab, SciPy, and Julia.

You could think about posting your question on Stack Overflow. They've got plenty of questions/answers already there.

Some informative links that show up quite often in answers:

User Amro has created a user-script for Matlab Syntax Highlighting for Stack Overflow. Use this link to install it.

3165 questions
0
votes
2 answers

How do I plot the following graph in Matlab code?

How do I plot the following graph in Matlab code with same dot lines and continuous line as in the graph? What is the code? The slant line is the $\eta=2 \xi+1$. I am a beginner in matlab. Kindly help me with the above drawing
MAS
  • 10,638
0
votes
4 answers

How to create a matrix from an equation in Matlab?

Let A = $(a_{ij})$ be the matrix with entries $a_{ij} = i^2+j^2$ A is a $N\times N$ matrix How can I construct a matrix from this equation?
0
votes
0 answers

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 appearing, and I do not understand why. Here is my…
0
votes
1 answer

Matlab code for creating the function

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}
Riaz
  • 2,174
0
votes
1 answer

Backwards Euler Matlab

I am asked to code Backwards Euler for the given differential: dy/dt = sin(3*t)-2*y , y0=1.2 ,x = [0 8] I know that Euler Forward is: y= y+h*(sin(3*t)-2*y) and the general formula for Backwards Euler is: y = y_i + h*y_i+1 I saw that for Backwards…
katara
  • 181
0
votes
1 answer

How to solve a matrix using Cholesky Decompositon on Matlab

I'm trying to solve a system of linear equations on MATLAB, I have written a code that solves the problem using Gaussian Elimination. But I was wondering how I could modify this to use other methods of matrix decomposition, such as Cholesky…
eenz
  • 1
  • 1
0
votes
1 answer

Solving system of ODEs in Matlab

I am trying to code an ODE system for $n=[-2,-1,0,1]$ $\frac{dx_n}{dt}=V_nx_n-x_{n+1}-x_{n-1}$ with some IC, say $[0 ~ 0~ 0~0]$: I have also a B.C at the two ends $n=-2$ and $n=1$, which I don't know how to implement at the moment, so to start I…
AtoZ
  • 273
0
votes
0 answers

How do I combine multiple MAT files into a single matrix?

I have a really dummy question about MATLAB coding, how can I combine multiple .mat file in un a single matrix to make then stat analysis on? I know how to load them using for-loop, but I can't "concatenate" them in a single matrix. ay help will be…
0
votes
0 answers

plotting a vector in matlab

I have a sample of size 180.And I would like to plot this using matlab.That is, X-axis with 1 to 180 and Y-axis these 180 independent values(180 sample values). Can someone help me with how to proceed. What is the easiest way to do this?Thanks in…
math
  • 353
0
votes
1 answer

machine epsilon in Matlab

If the distance between 7 and the next larger floating-point number is 2^-12. What is machine epsilon on that computer? What is the distance between 70 and the next larger floating-point number on that com- puter? Assume of course that the computer…
M Z
  • 11
  • 1
0
votes
1 answer

How do I plot an "unarranged" array1 vs array2 in MATLAB?

I have to plot two arrays: array1= [ 0.6321 0.6640 0.6997 0.8574 0.8824 0.9222 0.0893 0.1310 0.1600 0.3251 0.4008 0.7528 0.7985 0.9871 0.0417 0.2209 0.2694] array2 = [-40.8700 -46.9600 -47.3900 …
0
votes
1 answer

Matlab script for a dynamical system

The code function hennonMap(a, b, xn, yn, upper) Xval = zeros(upper, 1); Yval = zeros(upper, 1); for i=1:upper Xval(i) = xn; Yval(i) = yn; x = yn + 1 - a*xn^2; y = b * xn; xn = x; yn = y; end end Is giving me zeros, can anyone see why?
0
votes
2 answers

Modifying entries of a matrix selectively

In my linear algebra class we have a small component of learning Matlab with the occasional assignment. The question asked to modify an existing (not shown) $25 \times 25$ matrix with the following conditions: if an entry in the matrix $B$ is…
Mark
  • 825
0
votes
1 answer

Holding off displaying figure window in Matlab

The following piece of code is from the great book "An Introduction to Programming and Numerical Methods in MATLAB" by S.R. Otto and J.P. Denier x = 0:pi/20:pi; n = length(x); r = 1:n/7:n; y = x.ˆ2+3; plot(x,y,’b’,x(r),y(r),’r*’) ... Code continues…
0
votes
0 answers

The solution of final value problem (parabolic) as a series in Fourier type by Matlab

Problem: In $L^2(0,\pi)$, $\langle a,b \rangle = \int_0^\pi a(x).b(x) dx$. Finding a function $u(x,t)$ satisfy \begin{align} u_{t} - u_{xx} = F(x,t), \qquad \Omega \times [0,T]. \end{align} Dirichlet condition \begin{align} u(x,t) = 0, \qquad…
Mr. C
  • 1