Questions about the numerical programming language MATLAB.

learn more… | top users | synonyms

0
votes
0answers
11 views

Eigen vector normalization: MATLAB 'chol' (LAPACK DSYGV) & MATLAB 'qz' (LAPACK DGGEVX)

Two Eigen algorithms return Eigen vectors with different normalization methodologies: 1st algorithm, LAPACK DSYGV (the same as MATLAB eig with ...
0
votes
1answer
25 views

Nuemann boundary problem

I'm writing a solver for a differential equation with two neumann boundaries (u'(0)=u'(1)=0) and I can't figure out how to determine how to solve the problem. What will my boundaries be and how do I ...
0
votes
0answers
26 views

Simulation of dynamic system with coulomb friction (nonlinear damping)

I would like to simulate a dynamic system with coulomb friction. The force can be expressed as: $F_d = c_1 \dot{x} + c_2 sign(\dot{x})$ and it takes into account both the linear and the nonlinear ...
0
votes
0answers
28 views

Numerically boosting between reference frames

I have a question about numerically boosting between reference frames in MATLAB. Simply stated, if I have a function $f(x,t)$, I want to write it in a new frame, ...
0
votes
1answer
54 views

What is the best method to combine multiple vectored results into one chart?

Currently I am working on my research report where I've done a lot of measurements. For now I have uploaded everything into Matlab and visualise each on chart. Each one consists of 4 lines drawn with ...
0
votes
0answers
42 views

how to pick a submatrix of a sparse matrix quickly(matlab)

I have a large sparse matrix A and i want to pick the submatrix of it to do block jacobi iterations. For the blocks, i have get a matrix Q that contains the index of nonzero entries in its Jth column ...
1
vote
1answer
55 views

Switch between 2 equations to be given to ODE using events

I am trying to simulate a system with bilinear stiffness described by the following equations: $25\ddot{x}+15\dot{x}+330000x = p(t)$ if $x < 0.00072$ $25\ddot{x}+15\dot{x}+930000x = p(t)$ if $x ...
0
votes
1answer
54 views

Help me analyze the computational cost of two kinds of operations

everyone, I have a question about computational costs for a algorithm. That is: I have two vectors $u_n,\ v_n\in \mathbb{C}^N$, a matrix $A\in \mathbb{C}^{N\times N}$ (can be both sparse and dense) ...
1
vote
0answers
54 views

How to solve an ode with stochastic time-dependent input

I am trying to repeat an example I found in a paper. I have to solve this ODE: $25 \ddot{x} + 15 \dot{x} + 330000 x = p(t)$ where $p(t)$ is a white noise sequence band-limited into the 10-25 Hz ...
2
votes
2answers
142 views

Eigenvectors: MATLAB vs LAPACK DGGEV or DGGEVX

If we call LAPACK DGGEV or DGGEVX routines for two badly-conditioned matrices in a C++ code, will we get the same eigen-values ...
5
votes
1answer
86 views

What is a good way to take fractional powers of a matrix in MATLAB?

I am working on a problem that involves taking fractional powers of particular matrices. For the matrix A with 2 on the main diagonal and -1 on the sub and super diagonal (the finite difference ...
3
votes
1answer
100 views

Why is my MATLAB code for back-substitution slower than the backslash operator?

I wrote the code below to invert an upper triangular matrix, avoiding any possible multiplication/subtraction by zero. It just uses $\frac{1}{6}n^3+\ldots$ flops instead of $n^3+\ldots$ flops. ...
1
vote
0answers
73 views

Optimizing rank computation for very large sparse matrices

I have a sparse matrix such as ...
1
vote
1answer
67 views

Nonlinear ODE to solve Duffing's equation

I am trying to solve the Duffing's equation in MATLAB. $ m\ddot{y}+c\dot{y}+ky+k_{3}y^{3} = f(t) $ where $ f(t) = A \sin{\omega t}$ To do that I wrote a function to be given to the ode45. ...
0
votes
1answer
45 views

Why doesn't the integral of a smoothing kernel equal 1?

I was checking the unity condition on a smoothing kernel for SPH, however I don't understand why the integral is not giving 1. The kernel function is $\displaystyle W(||\vec r||,h) = \frac{315}{64\pi ...
0
votes
0answers
66 views

2D cross section from 3D surface

I am trying to apply the "restoring force surface" method to a dynamic linear system. The idea behind this method is that, knowing acceleration, displacement, velocity and input force it is possible ...
0
votes
0answers
12 views

About Intersection of two convex polytope? [migrated]

the intersection of two convex hull of two polytope P and Q , is it the convex hull of the intersection of P&Q ? Conv(P) ∩ Conv(Q) = conv(P∩Q) ???.
0
votes
1answer
59 views

Scaling factor of the inverse Fourier Transform (for convolution purposes)

I have a certain 2-D function. More properly, I have not the function itself, but the matrices $[X,Y,Z]$, where $X,Y$ are $1\times n$, and $Z$ is $n \times n$. Now, I want to calculate a a new ...
1
vote
1answer
103 views

What kind of test cases are convenient to use for testing the code for Euler equations of gas dynamics in polar coordinates?

Consider Euler equation of gas dynamics in polar coordinates as $$ \left( \begin{array}{ccc} \rho \\ \rho u_{r} \\ \rho u_{\theta} \\ E \end{array} \right)_{t} + \frac{1}{r} \left( ...
0
votes
0answers
59 views

Piecewise linear approximation of an experimental data curve. Knots position constrained

I need to fit a curve, obtained from experimental data, with a piecewise linear model (4 knots and therefore 3 lines). I tried using the MATLAB function ...
0
votes
2answers
46 views

passing arguments to ode45 with 'flag'

I want to pass additional parameters to the ode45 function in MATLAB. There are many questions already on this, but I also have a 'flag' argument in my function. ...
1
vote
0answers
54 views

MATLAB: incorrect computation with pdepe for parabolic-elliptic system

I have found that MATLAB solves 1D parabolic-elliptic system incorrectly by using pdepe function. Here is a system: $$ u_t = u_{xx} + 2, $$ $$ 0 = v_{xx} + u. $$ Boundary conditions: $$ ...
1
vote
1answer
140 views

How to write a function-generating code in Python/MATLAB?

I want to write a code that generates a function I(t) that satisfies the following condition: $\frac{\big<I(t)^2\big>}{\big<I(t)\big>^2} > 2$ In other words, $\frac{\lim_{T \to ...
2
votes
1answer
43 views

single-variate function variational Intensity Plot for Matlab

I'm wondering if it's possible to create functional intensity plots in matlab. Examples of what I'm looking for are below found in this paper: These figures were (guessing) probably made in R, ...
1
vote
1answer
48 views

Plot a surface from data sets in MATLAB

I tried to plot a surface in MATLAB but, since it is the first time I had to do something like this, I need a confirmation on the process I followed because it is important for my project to plot the ...
3
votes
0answers
182 views

Numerical integration of acceleration experimental data

I have a vector containing acceleration measurements and the corresponding vector of times in which measurements are taken. To obtain velocity and displacement I used the cumtrapz() function already ...
-4
votes
1answer
55 views

Can anyone give me some suggestions about optimize my Matlab codes?

recently, I try to write a Matlab codes to implement a sparse approximation inverse factorization method proposed by M. Benzi in his paper http://www.mathcs.emory.edu/~benzi/Web_papers/ainv.pdf this ...
2
votes
1answer
77 views

Saving symbolic function to increase efficiency in Matlab

I have a lengthy expression which is calculated using symbolic differentiation of a rather complicated function. I now intend to call this resulting (symbolic function) in a for loop many times, and ...
1
vote
1answer
26 views

Maple stored variable to be read into Matlab

I have a a function $f(k)$ (calculated in Maple) which is huge and stored in a variable called 'sum' on my drive (with the help of 'save' command in Maple). Since the function is huge, Maple is unable ...
1
vote
1answer
50 views

numerical integration of exponential which contains complex function

Hello everyone i'd like to get the result of Fresnel-Kirchhoff integral in paraxial approximation to the cylindrical diffracted wave and here is a part of my code and if it is solved gonna be carried ...
0
votes
1answer
32 views

How to plot function with evenly spaced xvalues in Matlab

'Im trying to plot this function func=exp(x-sqrt(2))-cos(x-sqrt(2))-(x-sqrt(2)) in Matlab using 101 evenly spaced x values. If I just say fplot(fun,[-1 3], 'o') the graph is the correct shape but the ...
0
votes
1answer
60 views

2nd Order finite difference for 1D wave equation matlab issue

I'm trying verify that a 2nd order finite difference in space and time approximation of the 1D wave equation is really 2nd order. My Matlab implementation tells me otherwise - I'm not sure of what ...
2
votes
1answer
64 views

Solving a pair of high-degree polynomials in two variables with Maple

I have two algebraic equations I am trying to solve in Maple. They are: $14\,{a}^{26}{b}^{2}-91\,{a}^{24}{b}^{4}-364\,{a}^{22}{b}^{6}-1001\,{a} ...
2
votes
1answer
122 views

Solving a nonlinear equation with random variable

I would like to solve an equation that looks like this UPDATE $E[(R^{1-\gamma})(r_k+\theta-r_z)]=0$ , where $R=\phi r_z+(1-\phi)(r_k+\theta)$ and $\phi\in[0,1]$, $\theta$, is a random variable ...
4
votes
0answers
146 views

Why does Matlab's integral outperform integrate.quad in Scipy?

I am experiencing some frustration over the way matlab handles numerical integration vs. Scipy. I observe the following differences in my test code below: Matlab's version runs on average 24 times ...
1
vote
1answer
40 views

Matlab equivalent of scipy's 'vode' and 'zvode' ode routines

In python I have used the ode method from scipy.integrate. There I used the vodeintegrator ...
1
vote
1answer
142 views

matlab: []*[] == [] makes vectorized code difficult

In my (admittedly brief) experience, there have been instances in which the code got uglier because []*[] == [], and it would be possible to write more elegant code if it was defined to be 0 instead. ...
0
votes
0answers
32 views

Ideas for reducing the complexity of a 3D density function for generating a ternary surface plot in Matlab

I have a 3D density function q(x,y,z) from a PDE that I am solving that I am trying to plot in Matlab 8.3.0.532 (R2014a). The domain of my function starts at a and ends at b, with uniform spacing ds. ...
0
votes
1answer
63 views

Windows C++ library for operations on mesh with a mex-interface in Matlab?

Please recommend me a well documented C++ library that I could wrap with a mex-interface in Matlab. The library should have the capability to read meshes (optimal in different formats, at least in ...
2
votes
1answer
65 views

How to know whether a boundary-value ODE problem is well defined?

I am using bvp4c from Matlab to solve a boundary values ODEs problem. Given the ODEs and boundary conditions, is there any way to have more information on the solutions? How many do I expect? 0, 1, ...
1
vote
1answer
48 views

How to impose an integral conservation in solving ODEs boundary value problems (BVP)?

I have a system of coupled ODEs that I want to solve. The functions are A(x), B(x), C(x). It is a boundary values problem. I am using Matlab bvp4c. So far I am not satisfied with my solutions. For ...
2
votes
1answer
120 views

Estimating mutual information of sine time series using 2D kernel density estimators

This is an attempt to reproduce Moon et al. 1995, and the author's copy can be obtained through here. As a benchmark, we estimate the time-lagged mutual information of a simple sine signal ...
2
votes
1answer
127 views

Is R or Matlab currently faster?

The most up-to-date performance benchmarks comparison between R and Matlab that I could find are several years out of date: 1 2 Is anyone aware of a more up-to-date comparison?
0
votes
0answers
167 views

How to use the Freefem++ (or Fenics) for solving 3D Helmholtz equations or Maxwell equations

I recently want to solve the three-dimensional Helmholtz equations with ABCs via the edge element method. But I am familiar with the program of C++/Python (-type) language, so I want to obtain some ...
6
votes
2answers
104 views

Evaluating 6D Gaussian Integral in Matlab

I have to compute the accuracy of a new Gaussian mixture fitting algorithm. One of the tests include computing the probabilities in certain intervals in a 6D hyperspace. Also, the integral of the ...
1
vote
1answer
99 views

What is the algorithm that matlab used in its built-in function 'pca'?

Do anyone know what is the algorithm that MATLAB used in its built-in function "pca"? I have the following data set: 148.9820 55.8438 210.2150 149.3030 56.8891 208.4280 151.4400 ...
1
vote
1answer
108 views

Calculate the machine epsilon in Matlab

How can I calculate the machine epsilon for two numbers then calculate the theoretical limit for machine epsilon in Matlab ?
0
votes
1answer
42 views

How to find max and min bounds of a uncertain function

First I would like to say that I have searched the for uncertain fitting, robust fitting, linear optimization, convex optimization, etc. But I'm lacking the knowledge to solve this problem, and I need ...
0
votes
1answer
93 views

a circular plot from a vector which represents the temperature along the radius surface, which is the same for every radius

I have calculated the temperature of the section of a cylinder, which is subjected to a heat flow on its upper surface. Getting the temperature distribution in the 2D section. As shown in the ...
1
vote
0answers
75 views

Histogram separation energy equation based on Bhattacharyya

I am working in level set method, specially Lankton method paper. I try to implement Histogram Separation (HS) Energy problem (Part III.C). It based on Bhattacharyya to control the evolution of ...