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

Matlab is calculating the standard deviation differently

I want to understand why Matlab is giving me a wrong answer when I ask for the standard deviation. For example, I was trying to get the standard deviation of this matrix: It doesn't make sense, because the first column $[1;4;7]$ gives me $3$ and…
user42912
  • 23,582
0
votes
0 answers

How to construct this n × n matrix using “diag” function in matlab?

For this questionenter image description here I know something the usage about “diag” function, when n increases, does the matrix looks like a diagonal matrix that other pivots fill with zeros? Does this matrix can be constructed by simply calling…
0
votes
1 answer

Plotting Piecewise functions in Matlab

I tried this code in MATLAB in order to plot the piecewise function: f(x) = cos (x) for x < 0 and e^-x (1 - x^2) for x >= 0: p y=piecewise(x) plot(x,y) xlabel('x') ylabel('y') title('Plots of $y = \cos x$ and $e^(-x)(1 - x^2)$', 'interpreter',…
user634745
0
votes
1 answer

graphical representation with (x, y) in Matlab

I need to plot a graph of system differential equation in Matlab. I am new in this program. $$ \begin{cases} \dot x=2*x+y \\ \dot y=2*(x^2-1)*x \end{cases}$$ This system in nonlinear and functions in Matlab as "quiver" don't help me and there…
GIFT
  • 321
0
votes
2 answers

$x_1[n]=0.9\delta[n-5]$ in Matlab (Checkm

I have never used matlab before and just started working on my first exercise and don't have a clue what I am doing. I would appreciate any pointers to let me know if what I am doing is write or wrong. The Question: Generate and plot the following…
Gineer
  • 727
0
votes
0 answers

Plotting an intersection in Matlab

How do I plot an intersection of two surfaces in Matlab? I mean this in the sense, that any line in 3D is an intersection - it can be defined by two equations in a system. How do I plot a system of two equations (one implicit, one explicit) in…
0
votes
1 answer

How to plot surface on matlab on domain?

How would I plot the surface S z=(1+x^2)/(1+y^2) over the region |x|+|y|<=2 ? I've tried numerous things, but I cannot get it so that the surface is constrained to the rhombus/square-shaped region.
student
  • 89
0
votes
1 answer

The Latex command $\text{abc}$ does not work in a Matlab legend?

I am using Latex formatting in the legend of a Matlab plot. For some reason the Latex command '\text{some word}' doesn't work. Matlab prints it as $\text{abc}$. For example, in the following legend statement, the first items gets formatted properly…
sonicboom
  • 9,921
  • 13
  • 50
  • 84
0
votes
1 answer

Matlab Syntax (1:end-1) - Explanation

Could someone explain me this code? meas.jerk.time = (meas.acc.time(1:end-1) + meas.acc.time(2:end)) ./ 2; Assuming that meas.acc.data and meas.acc.time are vectors with the same number of elements, then diff on the data vector will return a…
Shalomi90
  • 101
0
votes
1 answer

Typing a large size block matrix on matlab

I am reading this paper The iterative methods for computing the generalized inverse of the bounded linear operator between Banach spaces Where I came across a matrix $A \in \mathbb{C}^{58\times 57}$ (Example 4.2) given as follows: $A =\left( …
Srijan
  • 12,518
  • 10
  • 73
  • 115
0
votes
1 answer

Matlab Storing Vector after Iterations

I am having serious issues storing information in a vector after every iteration. Suppose that we have this code; delta = 0; figure(1) while delta < 30 [t,x_]=Ass3(10,8/3,10+delta,100,1,1,1) hold on plot3(x_(:,1),x_(:,2),x_(:,3)); grid on …
JayP
  • 1,096
0
votes
0 answers

MATLAB Solving system of ODE's with ODE45

In my uni course we are having to develop a matlab script which determines the solutions to specific ODE's. The following system of ODE's is as seen below in the image, with the question following; I am seriously struggling to understand how to use…
JayP
  • 1,096
0
votes
1 answer

Is there method to calculate the equation in pic?

Only x_k is unknown. Does any method to solve this equation exist? I have tried use solve() in matlab to solve this equation. But failed after any strive. $$\large{\frac{y_3-y_1}{y_2-y_1} =\frac{(e^{-\beta q_k})^{x_k}-(e^{-\beta \hat…
0
votes
0 answers

eigenvalues of block Tridiagonal matrix

I'm looking for a code in Matlab or any other program which can calculate all possible eigenvalues for a block Tridiagonal matrix of size 1000 or more, I have tried a routine in Matlab with eigs but it seems to me there are many hidden eigenvalues…
S.N.A
  • 199
0
votes
1 answer

How can I plot the graph of a possibility distribution function?

I want to plot the graph of this possibility distribution function. I write the Matlab code. But it does not work. please help me. The Matlab codes are given below: clear all format long; format…