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

Does matlab have a function which can calculate the intersections of two line in N dimension?

Does matlab have a function which can calculate the intersections of two line in N ($N\in R$)dimension? line 1 is as follows $w_1^Tx_2=c_1$, where $w_1,x_1 \in R^N$ line 2 is as follows $w_2^Tx_2=c_2$, where $w_2,x_2 \in R^N$ Sorry, the above are…
Vivian
  • 583
0
votes
1 answer

Generation of samples from a given distribution

How to generate samples from a given density function in matlab. The PDF of the random variable is given by $f_Z(z) = \left\{ \begin{array}{ c l } \frac{3}{a^3} \left(a + 2z\right)^2 & \quad \textrm{if } -\frac{a}{2}\leq z < 0 \\ …
0
votes
1 answer

surf plot of f(x,y). With gridlines, but more sparse than default

surf(x,y,z) where z is oscillatory. Therefore x,y are 100x100. I want the gridlines (don't want to use flat or interp options). However, too many gridlines don't look good. Looking for a way to reduce gridlines by 50% or 75% etc. in both x and y…
Karl
  • 31
0
votes
0 answers

Developing a generalized code to obtain the impulse response and the output for a given input for any LTIC in MATLAB and then plotting it

Equation of dynamics are given by the differential equations System 1.1 : $\quad\quad (D+2)x(t) = (3D +5) r(t)$ System 1.2 : $\quad\quad D(D+2) x(t) = (D+4) r(t)$ System 1.3 : $\quad\quad (D^2 +2D+1) x(t) = D r(t)$ We have to write a code which can…
C-137
  • 1
  • 2
0
votes
0 answers

Generating all the n-dimensional array in Matlab in which each entry can get only two value

I wanted to generate all the n-dimensional vectors that each of its entries can get only two values (e.g. for n=3 we get $2^3=8$ vectors) and put all these vectors into a matrix. Is any specific command for this purpose? I'll appreciate any…
user830270
  • 23
  • 6
0
votes
1 answer

Matrix manipulation with matlab.

Is there a way for a given matrix: $k= \left( \begin{array}{cccccc} a_1 & b_1 & c_1 & d_1 & e_1 & f_1\\ a_2 & b_2 & c_2 & d_2 & e_2 & f_2\\ a_3 & b_3 & c_3 & d_3 & e_3 & f_3\\ a_4 & b_4 & c_4 & d_4 & e_4 & f_4 \end{array} \right)$ to create two…
20317
  • 139
0
votes
0 answers

Debugging problem on Matlab

I have been trying to run a piece of code written in Matlab that contains the following: function list = shellsort(list); interval = floor(length(list)/3); I get the following error message: Not enough input arguments. Error in shellsort (line…
0
votes
1 answer

What does it mean [X,T]=MATRIX?

I'm starting to study this example but I'm not understanding the matrix operation on matlab: Whe it does [X,T] = prprob; it will copy the predefined 26x35 matrix prprog to X and a identity matrix with less rows (26x26) to T. It works fine. I tried…
0
votes
0 answers

Using matlab to solve system of algebraic equations, got no answers

I used the following matlab code to solve a system of algebraic equations, but I got no answer. clear; clc; close all; syms x y z u eqns = [2x + 1 == 2ux, 4y == 2uy, 6z == 2u*z, x^2 + y^2 +z^2 == 1]; S = solve(eqns,[x y z u]); S.u the result…
0
votes
0 answers

How to write MATLAB code to find the answer of the equation with given all values of its variables?

I'm practicing MATLAB. and I stuck with this problem. Suppose I have Equation in general form like this $d = ab + AB^2 + abB$ I have all values of its variable $a = 1 , b=2, A=4 ,B=6$ How to write MATLAB code to get the answer of this…
0
votes
0 answers

finding one Special realization in matlab

I want to find realization for a system like below how can I do that in matlab.
0
votes
1 answer

Rounding numbers in MATLAB

I am making a function for finding the approximate value of the second derivative (using the forward difference formula) of $sin(x)$ in $x=\frac {\pi}{3}$ with step $h=10^{-n}$ for $n=1, 2, 3, 4, 5$ The problem is that MATLAB rounds all the results…
Silviya
  • 109
0
votes
0 answers

Weights in Markowitz portfolio[Matlab]

Hello everyone I read article about Plotting an Efficient Frontier Using portopt.…
0
votes
1 answer

Draw plane via 3 points

I have 3 points (1,1,1), (2,2,2), (2,2,0). It is enough to draw plane via these 3 points. But how to do this in Matlab? I'm planning to use surf() function. I do: x=[1 2 2 ] y=[1 2 2 ] [X,Y] = meshgrid(x,y) it creates mesh : X 1 2 2 1 2 2 1 2…
vico
  • 101
0
votes
0 answers

Plot channel vs error probability

How to give relation between channel vs error probability .with the given marginal probability and to Comment on result based on finding. How to approach this question? Can someone please help?