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

Evaluate symbolic expression in MATLAB

I am trying to evaluate the following infinite series in MATLAB : $$\hat{c_{k}}(x) = \sum_{m=0}^{\infty} a^{m} cos(2^{m+1}k \pi x)$$ For this I have written the following code: function func = cosfun_hat(a,k) syms m x; …
Vizag
  • 3,257
-1
votes
1 answer

well formated table in matlab

suppose I have two vectors $ A=[ 1 ,2, 3, 4]$ $B=[ 5 ,6, 7, 8]$ of the sam length and an additional vector which is "smaller" by one elment, i.e. $C=[9, 10, 11]$. Now I define $\operatorname{display}=[A,B,C]$ and want to print a table, using…
user20869
-1
votes
1 answer

How to solve Newton's method in matlab?

I have to adapt Newton's implemantation for the null solution of calculations following this function $x = 1 - e^{-2x}$.
-1
votes
2 answers

Calculate angles and absolute value of complex number -Matlab

how to Calculate the angles and absolute value of complex number by using matlab commands: the complex number is:$$e^{3+4j}+e^{3-4j}$$ tyy!!
Owen
  • 45
-1
votes
1 answer

Displaying large matrices in matlab with pause when screen is filled?

Is there a function to display large array on command prompt with displaying only part of it and waiting until user enters something from keyboard.
user16409
  • 367
-1
votes
1 answer

Max value of a function in MATLAB

I am looking to find the max value of this function: log(x^(sqrt(2))) - x^3 + 4 I am having trouble with how to go about this problem. Any help is great. What I have right now is: y =@(x) log(x).^(sqrt(2)) - x.^3 + 4 ; x0 = 1; x =…
Nate
  • 1
-1
votes
1 answer

How to put a function in a function in matlab and plot it?

Now I am new to matlab, and now the basic syntax, however I am not sure how to write a function to loop for instance the following recurrence equation: $y(n+1)=\exp(-y(n))$ .. where $y(1) = \exp(-y(0))$ and $y(0) = x$
Gauss
  • 41
-1
votes
1 answer

Hi I have a problem using a while loop with matlab

I have a problem using a while loop. My main objective is to simulate a fanno flow problem when for a case where the length of the tube is longer than require. this means we have to change the mach number in the middle. my code is the…
-1
votes
2 answers

A question about the matlab error "Subscript indices must either be real positive integers or logicals"

I wrote a simple matlab code to evaluate the ground state energy of a set of tight-binding Hamiltonians with local magnetic impurities. I always encounter the subscript error until I add a new line, "clear H1u H1d eigu eigd eig", before the end of…
-1
votes
1 answer

How to Estimate the mean and covariances for all classes from training set?

A training set of 2000 samples ( value :2000 * 2 ) named training_set. how can i estimate the mean and covariances for all classes from training set. already tried mean and cov function.but every time get " Undefined function or variable "…
-2
votes
2 answers

Matlab: Missing something simple.

hi there so i'm about to return to uni and so i thought id brush up on my ole matlab skills before returning so i went back to basics. at the moment im going through previous exams and the question issued was. (b) (15 marks) Write a matlab script…
Vaas
  • 1,003
-2
votes
1 answer

How to initialize a1 , a2 ,..............a100 as symbolss in matlab with code

If we want to use a1 as a symbol in Matlab as follows : syms $a1$, but I want to use all $a1,a2,.....a100$ as syms ,how can do that with simple code in Matlab ,thanks
-2
votes
1 answer

plot multiple discrete graphs on the same figure

having troubles using 3 stem function on the same figure. my code (only for the plot part) is: figure(1) stem(s,'*'); hold stem (v,'kx'); hold stem(x,'color',([0 0.5 0])); title('the discrete signals'); xlabel('n'); ylabel('signal…
-2
votes
1 answer

How to split a dataset in test and training set?

How can I split a data set in training and test data set after creating a data set named first_data (contains 3000 samples) in MATLAB? I want to split $2000$ samples as training and $1000$ samples as test data set. I am new to MATLAB- thanks in…
1 2 3
22
23