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

how to get the answer for the following integration?

$ti(t)$ is a function of time which is normally given with (time,value) pairs and not defined mathematically. i need to get the value $td(t)$ by solving the following integration: $$\int_{t-td(t)}^t\frac{1}{ti(\tau)}d\tau==1$$ so how can I get the…
obay
  • 11
0
votes
1 answer

MATLAB function to find the argument of a discrete time complex signal

I have a MATLAB question. How can I calculate and subsequently plot the argument of $$x(n) = e^{(0.1 + 0.3j)n}$$
nikos
  • 455
0
votes
1 answer

Iterating substitution question (Matlab)

I have four relations between A and B as below. A(i)= B(i) + B(i-1) B(i)= A(i) + A(i-2) A(i)= B(i-1) + A(i-2) B(i)= B(i-1) + A(i-2) Assume i is 7 and A(7),A(0),B(7),B(0) are known. (Just for easier calculation here, so that my iteration will be from…
0
votes
1 answer

Matlab: integrate function in dependence of a parameter

I am a matlab beginner and can not spot the mistake in the following code: a=0.5; b=0.5; f=@(u,x) exp(-x.^2/2)*(2*pi).^(-1/2)*exp(log(a+b.*x.^2).*u); t=0:0.1:1; g=0*t; for i=1:numel(t) fab=@(x) f(t(i),x); …
Seneca
  • 235
  • 2
  • 8
0
votes
1 answer

Sorting and removing data in MATLAB

I am new to MATLAB and I have to analyze a file containing lighting data from WWLLN. The data file contains: latitude of stroke in first row, and longitude of stroke in second row This file has lightning locations occurring globally. However, I am…
0
votes
2 answers

plotting two graphs in matlab

it's been 5 hours and I'm trying to plot two graphs in matlab but in vain, here is my code x = -pi:.1:pi; z =(1/(2*pi))*exp(-power(x,2)/2); y=((n.^(n/2))/fact(n-1))*((x + sqrt(n)).^(n-1))*exp(-sqrt(n)*(x + sqrt(n))); plot(x,z,'color','r'); hold…
Houda
  • 787
  • 5
  • 15
0
votes
1 answer

Function with 2 outputs

I have written the following code: function [ z,a ] = complx( numb ) z=abs(numb); a=angle(numb); end but I get back just z and not a
gbox
  • 12,867
0
votes
1 answer

remove repeated rows on matlab

I have a $n\times 2$ matrix as the following example 1 21 3 23 3 23 1 21 6 24 6 24 6 24 and I need obtain a new matrix (with 2 columns) with non reapeated rows, which in this example is 1 21 3 23 6 24 How I can do this on…
yemino
  • 814
0
votes
1 answer

Back calculation of simple Haversine formula

I have coded the simple Haversine formula (matlab) and it works fine (see below). If I provide 2 sets of latitude/longitude I can find the distance between them. Despite this, I need to invert the procedure and calculate 2 sets of coordinates based…
user1183643
0
votes
1 answer

Matlab iteration

$p,q,e$ and $m$ are known $n=p \times q$ $c=m^e \mod n$ I want to get the $j$, when $c=c^{e^j}$ What am I doing wrong? function j=iter(p,q,m,e) n=p*q j=1; b=m^e c=mod(b,n) while c~=c^(e^j) j=j+1; end end
0
votes
1 answer

curve fitting in matlab

I have four curves for four different times as shown below in the figure. I need to draw the curve for time in between the given times e.g., I need to plot the curve for $t= 3$ and $t=10$ in matlab (this is just an example shown in below…
Tapan
  • 101
0
votes
1 answer

Givens Making Diagonal Element Null Matlab

Given the following matrix: >> A = [3 3 0; 4 4 5; 0 0 1] A = 3 3 0 4 4 5 0 0 1 The rotation matrix would look something like this: >> G = [3/5 4/5 0; -4/5 3/5 0; 0 0 1] G = 0.6000 0.8000 0 …
0
votes
1 answer

With rows have a -1 in its third column? (matlab)

Let me explain my question with an example. I have the matrix $\begin{pmatrix}0 &5 &1 \\ 0&5&-1 \\ 10&-55&2 \\ 4&0&-1 \\ 1&1&1 \\\end{pmatrix}$ and I need to know the number of each row that has a $-1$ in its third column. How I can do this…
yemino
  • 814
0
votes
1 answer

Function Plotting in Matlab

I m new to Matlab and I need it for my senior seminar project. How would I plot a function of the form $x_{i+1}=f(x_i), \;f(x)=rx(1-x)$, for x=linspace(0,1) and some $\;r$? I m supposed to plot x as a function of time. Any help would be really…
0
votes
1 answer

Generate matrix of random number with constraints

I want to generate a matrix of random numbers (normrnd with mean == 0) that satisfy the following constraints using MATLAB (or any other language) The sum of the absolute values in the matrix must equal X The largest abs(single number) must equal…
Tim
  • 1