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

How to describe this matlab code with mathematical notation?

I need your help to describe the following matlab code in a scientific way: function [y,x]= select1() x=10*rand(1,7); m=[3 7]; dif1=abs(m(1)-x); dif2=abs(m(2)-x); if (sum(dif1(:) sum(dif1(:)>dif2(:))); y= m(1); …
1
vote
1 answer

MATLAB Vector Assignment of Arbitrary Length

Greetings: let's suppose I have a loop that will execute 20 times, and within that loop I'll obtain a vector of information whose length will increase, each iteration, from 2 to 20. Now suppose I have a matrix of dimension 20, and during each…
1
vote
1 answer

Sound waves under water, matlab

c(z) = 4800+p1+p2*(z/1000)+p3*e^((-p4*z)/(1000)) p1 = 0.0070 p2 = 0.0378 p3 = 0.0016 p4 = 1 Tabel values z = [0 500 1000 1500 2000 2500 3000 3500 4000 5000 6000 7000 8000 9000 10000 11000 12000] c(z) = [5050 4980 4930 4890 4870 4865 4860 4860 4865…
Amidii
  • 111
1
vote
1 answer

Write a function in MATLAB that returns the value of a function f (where f needs to be written by the user)

Newton's method for 2x2 case: $$J(x_n)s_n= f(x_n)$$ then update $$x_{n+1} = x_n - s_n$$ where $J$ is the Jacobian matrix formed from $f$. And $x_n$ is a 2-D vector. Write a MATLAB function to implement Newton's method for a system of 2 nonlinear…
user71346
  • 4,171
1
vote
2 answers

Finding points along a plot in Matlab

I have the following plot and a file of the data which creates that plot. I would like to have Matlab find the following points for me: [y,x] for peak noted by the 100% line [x] for where the plot crosses the y=0 line [x] for where y is 50% and 20%…
Carl
  • 405
1
vote
2 answers

Naming A Number of Variables in Matlab

If I need to get some variables values from a vector in Matlab, I could do, for instance, x = A(1); y = A(2); z = A(3); or I think I remember I could do something like [x, y, z] = A; However Matlab is not recognizing this format. what was the…
Book Book Book
  • 625
  • 3
  • 8
1
vote
1 answer

splitting arrays in matlab

Greetings All I'm trying to 1)split an array into multiple parts 2)export each part to separate wave files 3)re-import wav files and join them together to make sure the array data that was split up wasn't altered. I can do all of these steps the…
Rick T
  • 457
1
vote
1 answer

Confluent hypergeometric function of the second kind - KummerU Formula

I have the following formula for KummerU: U = gamma(1-b)*KummerMz(a,b,z)/gamma(a-b+1) + gamma(b-1)*z.^(1-b).*KummerMz(a-b+1,2-b,z)/gamma(a) from [https://pmc.polytechnique.fr/pagesperso/dg/confluent/KummerU.m][1] I am generating it in Excel using a…
1
vote
0 answers

outage probs vs number of transmit antenna

Can some one please help me with a matlab code for plotting outage probability against number of transmit antennas in a Massive MI-MO System? i have tried plotting and keep getting single values that can't be used to plot.
1
vote
0 answers

4d Integral in matlab

I'm trying to evaluate the integral using MATLAB with an equation containing 4 related random variables, thus the boundaries of the integrals are not constant. There are 2 exponential pdfs, and 2 other hyper exponential , and 1 Reyleigh CDF all…
mandez
  • 750
1
vote
0 answers

Getting same output dimension from the fimplicit matlab function

I am using fimplicit function to plot two implicit curves as follows: Limit=[ 0 1.5 0 15]; MDensity=1000; Exactcurve=fimplicit(f,Limit,'MeshDensity',MDensity); hold on Aproxcurve=fimplicit(faprox,Limit,'--','MeshDensity',MDensity); and the output…
Rock
  • 77
1
vote
2 answers

What does this command mean?

I am unable to interpret the following command in a MATLAB code while (fa > 0) == (fb > 0) I thought it says: if fa>0 , fb > 0 and both are equal to each other then do some commands. However, while running in debug mode, at I found that even then…
d'kar
  • 13
1
vote
0 answers

Plotting curve in matlab

I am given the coordinates of the center of mass of a particle $(x_G,y_G)$ with respect to time $t$, I want to plot a graph the shows the change in the position of the particle with respect to time. The first variable is the time $t$, I have thought…
2007
  • 11
  • 2
1
vote
2 answers

a question a bout plot in matlab

I am trying to plot 3-D figure in matlab. I know how to use plot3 and surface. But now I have a vector and no a matrix. Actually I have $(x,y)$ and $u(x,y)$ that $u(x,y)$ is obtained after solving my problem. when I using plot with mesh, my figure…
Rosa
  • 1,502
1
vote
1 answer

Finding the height of a trough through root finding methods

In my computer-aided-problem-solving class, I am asked to determine the height of a trough, through a root-finding method. I can choose between the bisection method, Newton's method or successive substitution. Whichever method I choose, I should…
Math420
  • 339