MATLAB 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 ... ...

learn more… | top users | synonyms

-1
votes
1answer
8 views

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 ...
-2
votes
1answer
16 views

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$ ...
0
votes
0answers
11 views

Matlab symbolic toolbox with unknown windows size

I have a problem when using Matlab symbolic toolbox to do some automatic derivation. However, in my problem, a window size is defined but the size is unkonwn. I want to extract data in one window. ...
1
vote
1answer
26 views

Not able to use fzero function in Matlab

I am new to Matlab. I am trying to solve a non-linear equation using this inbuilt Matlab function called fzero() but it's not giving me the results. The main file ...
0
votes
0answers
19 views

Coupled Differential equation of second order in matlab

I have a problem solving a system of differential equations of second order in matlab: $$ \left\{ \begin{array}{l l}\frac{d^2y}{dt^2}= \frac{-y}{(x^2+y^2)^{3/2}}\\ \frac{d^2x}{dt^2}= ...
0
votes
0answers
22 views

finding angle of spirals along with length of it's line at a certain point

I'm tying to calculate the angles (the angle between each line segment and a horizontal ray to the right blue) of spirals at a certain point along with figuring out the length of the other lines. see ...
0
votes
1answer
14 views

Determining the value of ECDF at a point using Matlab

I have a data $X=[x_1,\dots,x_n].$ In Matlab, I know by using [f,x]=ecdf(X) plot(x,f) we will have the empirical distribution function based on $X$. Now, if ...
0
votes
1answer
26 views

Understanding the transformation of values when plotting logscale in Matlab.

I'm playing with some transistor test data and having trouble understanding what is probably a very basic principle. Below are my two graphs, plotted linearly and then with a logarithmic scale on the ...
0
votes
1answer
26 views

MATLAB Feedback

I am trying to use the feedback function in matlab and for the most part I understand it. But I came across this syntax: [x1 x2] = feedback(sys1, sys2, 1, 1, -1); ...
0
votes
1answer
17 views

How to convert rational numbers to irrational numbers in disp in Matlab

How can I convert rational numbers to irrational numbers in $\operatorname{disp}$ in Matlab? I wrote a method in Matlab to estimate the value using the Newton-Raphson Method but when I use ...
1
vote
1answer
32 views

Where is the fixed point? — Matlab is cluless too

Consider the differential equation $$\dot{k}(t)=f(k)-(r+t_1)k-f(1-k)+(r+t_2)(1-k)$$ where $k,t_1,t_1\in[0,1]$, $r\in\mathbb{R}$ and $f:[0,1]\to\mathbb{R}_+$. I'd like to solve for the fixed point ...
0
votes
1answer
40 views

MATLAB Eigenvalues

So I am trying to get matlab to output the correct eigenvalue/eigenvector of a matrix. The matrix is: \begin{array}{ccc} 0 & 1 \\ -3 & -4 \end{array} The eigenvalues are: $\lambda_1 = -1, ...
0
votes
0answers
31 views

Matlab project - Jacobi method for tridiagonal matrices…

I have to do a project in Matlab to my University and I don't quite understand what I should do. I was given script that solves systems of equations with Jacobi's method with given tolerance and ...
0
votes
1answer
16 views

Large error after factoring h from fourth-order Runge–Kutta method

Consider $$\frac{dy}{dx} = 2x-y, \qquad y(0)=1$$ That has an exact solution $y(t) = 2t+3 e^{-t}-2$. But I want a numerical solution. So I decided to use forth-order Runge–Kutta method ...
0
votes
1answer
23 views

Matlab calculate output

I'm trying to write a matlab function that takes in a transfer function and the input so it can calculate the output. So far, based on this information under I have the following piece of matlab ...
0
votes
1answer
33 views

Roots of an equation using Maple

I am using Maple to find the roots of a non-linear equation in one variable. When I solve the equation, I get only 2 negative roots whereas if I plot the graph of the function, it also shows that the ...
1
vote
1answer
83 views

Incorrect angle detected between two planes

I want to calculate the angle between 2 planes, Reference plane and Plane1. When I feed the X,Y,Z co-ordinates of pointCloud to the function plane_fit.m (by Kevin Mattheus Moerman), I get the output ...
0
votes
1answer
21 views

Beta-binomial random number generator

Could someone help me find a random number generator from a Beta-Binomial distribution in MATLAB, R or SAS? Thank you!
0
votes
1answer
24 views

Building an nth order ODE in Maple (or Matlab)

The question is simple: given a system of ODEs, how can one construct the equivalent nth order ODE in Maple? In my case I have $$ \begin{cases} y''(t)+x'(t)+x(t)=f(t)\\ y''(t)+z''(t)+z'(t)+z(t)=0\\ ...
0
votes
0answers
25 views

Inverse Power Iteration converges to largest eigenvalue instead of smallest?

I am trying to write a Matlab function that takes a matrix and an iteration count and performs inverse power iteration to output the smallest eigenvalue. The problem is, as k increases, the function ...
1
vote
1answer
53 views

create a Gaussian distribution with a customize covariance in Matlab

the Matlab function 'randn' randomize a Gaussian distribution with $\mu= \begin {pmatrix} 0\\0\end{pmatrix}$ and $cov= \begin {pmatrix} 1&0\\0&1\end{pmatrix}$ Ineed to randomize a Gaussian ...
2
votes
1answer
38 views

Higher order numerical PDE schemes near boundaries, implementation in MATLAB

Followup to my previous question. The first order scheme proved unstable for my pde: $$f_t + A y f_x - B x f_y =0$$ So I'm looking to implement a higher order scheme (using these tables). I was ...
-2
votes
0answers
21 views

I need help about about 2nd order nonlinear differential equation in Matlab

I have to write a program in matlab to solve the $$\frac{d^2y}{dt^2}-(1-y^2)\frac{dy}{dt}+y=0,\hspace{0.5cm}y(0)=\frac{dy}{dt}(0)=\frac{1}{2}$$ I wrote the following code; ...
0
votes
1answer
20 views

Fitting a polynomial model to the data

I want to fit a line to the following data. But the line I have obtained is far from the data. What is wrong in the following least square problem? ...
1
vote
0answers
48 views

calculate the second derivative using `ode45`

I have a second order differential equation. I am using ode45 to solve the problem. ode45 converts the equations to the first ...
0
votes
1answer
48 views

Simulink model from a nonlinear State Space

I have the nonlinear state space already constructed in MuPAD as shown: u is the input and y is the output. What is the best way for me to take this to Simulink?
1
vote
1answer
40 views

How to draw or plot illustrative figures?

stackexchange users I would like to plot or draw some illustrative figures for my research paper. I've tried GeoGebra already. But couldn't draw them as I wanted. So my question is How can I draw ...
2
votes
0answers
78 views

How to find the Total Harmonic Distortion of a Periodic Signal through MATLAB?

How to find the Total Harmonic Distortion of a Periodic Signal through MATLAB? I just need help in confirming if my way of approach to finding the THD seems valid, I'm new to MATLAB so I'm not quite ...
1
vote
1answer
44 views

MATLAB, 1st order 2d hyperbolic equation, problem with convergence.

Follow up to my previous question: MATLAB: solving 1st order hyperbolic equation in 2 spacial dimensions The equation I'm solving has the form: $$f_t + A y f_x - B x f_y =0$$ I wrote the following ...
2
votes
1answer
36 views

Weed out numerical artifacts from matrix inversion

I am working with the inverses to a set of large sparse matrices (in Matlab). A key indicator for my application is the number of non-zero entries in each row, and I recently discovered that I was ...
2
votes
1answer
23 views

MuPAD - complicated solve() solutions

I am trying to solve an equation for one variable as shown in the picture: Judging from the output of the second command, I should be able to get an expression for $\ddot{\theta}$. I tried ...
0
votes
3answers
41 views

How do I define this matrix in matlab?

$$A = \begin{pmatrix} 2 &-1 & 0 & \dots & 0 \\ -1 & 2 & -1 & \ddots & \vdots \\ 0 & \ddots & \ddots & \ddots & 0 \\ \vdots & \ddots & -1 & 2 ...
1
vote
1answer
31 views

MuPAD - rearrange an equation

I have a huge expression, say $f(x_1,x_2,x_3) = 0,$ and I want MuPAD to try to express $x_1 $ in terms of $x_2$ and $x_3$ Is this possible?
0
votes
0answers
30 views

Using matlab to plot periodic orbits of a map

I am trying to plot periodic orbits of a map upto period 10 and I need help with the matlab code (not an expert in matlab). I talked about it to my advisor and this is what I have until now: In this ...
0
votes
0answers
9 views

plot a zero-order hold in matlab

I need to plot the following zoh expretion for$\ \ \ |\omega|\le20\pi,w_m=3\pi$ $$X_{ZOH}(j\omega)=\\ {2w_m\over j\pi ^2}e^{-5j\omega \pi/4w_m}sinc({\omega \over 2w_m})\sum^\infty_{k=-\infty}{2w_m ...
0
votes
0answers
16 views

MuPAD - differentiating a parametric function

I have a function of x(t) and theta(t). I want to differentiate wrt x(t), but I get an error when I try that. I will also need to differentiate the function wrt to x'(t). Any suggestions?
1
vote
1answer
30 views

MuPAD equation solving

I have x(t) defined as: x(t) = Symbol::subScript(x,0) + Rb*`φ`(t) I want to write the derivative of ...
-1
votes
0answers
10 views

How can i get the Transfer function of this Equation?

I have an equation with i want to simulate in Matlab. the Equation is y(t) = a/(b+x(t)) here x(t) is the input and y(t) is the output and a b are some constant. I don't know to to make its Transfer ...
0
votes
1answer
61 views

How can I integrate over an infinite interval in Matlab?

Would you please help me integrating the following function over an infinite interval in Matlab. Many thanks $$ \int_{-\infty}^{\infty}P(\lambda)P(0.1-\lambda) e^{-j2\pi \lambda} $$ In which ...
2
votes
1answer
45 views

Is there a function in MATLAB that will estimate the initial condition from a set of data?

I was given a state-space model of a system and a list of outputs for t=0 to t=5, sampled every 0.1 seconds and asked to approximate the initial condition. Is there a function in MATLAB that will take ...
1
vote
1answer
36 views

MATLAB: solving 1st order hyperbolic equation in 2 spacial dimensions

According to wikipedia, the equation $$\psi_t + \mathbf{u} \cdot \nabla \psi =0$$ is hyperbolic. However, when I want to solve it in MATLAB using the pde toolbox (link), the general formula for a ...
2
votes
0answers
29 views

Simulation Velocity of a harmonic oscillator system

I am write a simulation for get true Velocity of a harmonic oscillator system as Where P=[p1 p2;p2 p3] can find using Rung-Kutta Integration method with P(0)=[1 0; 0 1] This is code to find p Now, ...
0
votes
0answers
13 views

Simulation Position of a harmonic oscillator system

I am write a simulation for get true Postion of a harmonic oscillator system as Now, I want to write matlab code to get the true postion z of the system. However, ...
1
vote
0answers
18 views
1
vote
1answer
30 views

How do I plot normal distribution

If I know the range (1-24) and know the area (X), how can I plot a normal distribution so that the curve has area X?
1
vote
1answer
16 views

plotting an fft function

need to plot the folowing: $$X(j\omega)=\cal F\{{2\over\pi\lambda}\}*\cal F\{sinc(2w_m\lambda)\}-\cal F\{{4\over\pi\lambda}\}*\cal F\{sinc(w_m\lambda)\}$$ as a plot of $|X(j\omega)|$ for ...
1
vote
2answers
49 views

Would taking a course in Linear Algebra help with working with Matlab?

I'll soon be using Matlab in an engineering course I'll be taking next semester. So given how Matlab stands for Matrix Laboratory and Linear Algebra has a lot of matrices involved, does such a Linear ...
0
votes
1answer
24 views

fourier transform in matlab

getting an error while trying to do fourier transform. my code: ...
0
votes
1answer
40 views

Plotting multiple curves using ODE45

I am a beginner to using MATLAB, and I need a lot of help to understand what to do here. I would like to plot multiple curves using different initial conditions to my system of ODEs. Here is my ...
1
vote
1answer
44 views

Compound Gaussian distribution using matlab

I want to ask how can we generate Compound Gaussian distribution using matlab?