# Tagged Questions

28 views

### Relative error when computing derivatives via FFT

I want to compute a discrete derivative via the FFT. This amounts to multiplication by the wave number in Fourier space, as detailed in the stack exchange answer here. When I increase the ...
29 views

### implicit non-linear equations with complex variables

I am trying to understand a methodology for solving implicit non-linear equations with complex variables. I would like to solve for z1 below where z2 is known. Also both z1 and z2 are complex ...
33 views

### Anyone recognize this pattern? Plotting relationship between two parameters and their response.

First time asking a question here so hopefully I can provide enough information to you guys without explaining more than necessary. I'm doing some amateurish numerical analysis in MATLAB on some ...
56 views

### How to solve this complicated differential equation?

I need to know how to solve this complicated differential equation in $z$ either analytically or numerically : \begin{eqnarray} \frac{dx_1}{dz} &=& -ib_1x_1 - ikx_2 \\ \frac{dx_2}{dz} ...
33 views

### Solving solely continuous system of ode's with matlab

I'm working with the numerical integration of the system of differential equations, $\dot{x}=f(x)$ with the vectorfield, $f(x)$ being solely continuous. Examples of the systems which I'm working on ...
39 views

173 views

### Change MATLAB code from Lax-Wendroff to Leapfrog

I want to see how leapfrog would look using this code, but I'm having issues implementing it. I think my biggest problem is adding in the $U_j^{n-1}$ term, I just don't get the logic. Here's what ...
44 views

### Numerical Differentiation using Numerical Methods

I am currently studying Numerical Differentiation in MATLAB using Numerical Methods in Engineering with Matlab by Jaan Kiusalaas, and I am stuck at exercise 13 from Problem Set 5.1 from Chapter 5 ...
54 views

### The definition and meaning of “machine epsilon” in MATLAB

I am taking a introductory course in numerical mathematics, using MATLAB and a numerical math text that refers to MATLAB often. In the text, the machine precision is defined as: The distance ...
30 views

### What is wrong with this algorithm [closed]

Crout factorization: n=10 A = full(gallery('tridiag',n,-1,2,-1)) i = 2:(n-1); bmid = i.^2 / ((n+1).^4) b = [1+1/(n+1)^4, bmid, 6+(n^2)/(n+1)^4]' for i = 1:n L(i,1) = A(i,1) end for j = 1:n U(1,j) = ...
40 views

### Backward error for Crout factorization

Ok, can someone please tell me what is the formula for the max error in LU decomposition of Crout factorization?
280 views

### Gauss Seidel iteration in matlab

I've posted this question before for crout factorization. Now, I need help with Gauss-Seidel iteration. Write a program that takes a value for n and solves for x using the following method: ...
39 views

### How can I solve an ODE when $F(x_0)=F'(x_0)=0$ is given at an unknown point $x=x_0$ using bvp5c?

I'm attempting to solve the following ODE using MATLAB bvp5c. I've used bvp5c for other typical multipoint boundary value problems but I have no idea how to deal with ODEs with conditions given at an ...
62 views

### (newbie) spectral derivative

I have data that form a scalar field on a 2D grid, evenly spaced. The grid has a finite size. There is no particular periodicity patern in my data. I want to calculate the value of the gradient at ...
119 views

### Matlab ode45 numerical solution

I'm trying to solve a 2nd order differential equation, using the Runga Kutta's ode45 function in Matlab. It's for a bachelor project, where I'm trying to simulate the behavior of a spherical robot, ...
46 views

### A numerical inverse Fourier transform

I am doing an research in phase noise, And I'm troubled in a paper. In that paper,it says when perform a inverse Fourier transform on ...
38 views

### Ordinary differential equations with signed first derivative

Consider the following coupled set of ordinary diferential equations: \begin{align} (K_{pa}+K_r)y_1(t)-K_ry_2(t)+C_0\operatorname{sign}(\dot{y}_1(t))\lvert\dot{y}_1(t)\rvert^\alpha &= ...
46 views

### How to approximate a smooth function

Now I have a target smooth function f which is infinitely differentiable over $R^d$, $f \in C^{\inf}(R^d)$. $f = \Sigma c_ig_i(x)$, where $c_i$s are unknown coefficients and $g_i(x)$ is a smooth ...
68 views

### Matlab and Van der Pol

Trying to use ODE15s to solve Van der Pol Oscillator for mu=2. I am getting the following error: Warning: Failure at t=4.968128e+00. Unable to meet integration tolerances without reducing the step ...
96 views

### Interest Rate Tree in Matlab

I would like to calibrate a interest rate tree using the optimization tool in matlab. Need some guidance on doing it. The interest rate tree looks like this: How it works: 3.73% = 2.5%*exp(2*0.2) ...
40 views

### Best optimizer in Matlab for this problem?

I need to do yield curve extraction for fixed income. I have 10 fixed income instruments for which I have values. The method is called Nelson-Siegel Method: ...
68 views

### Calculate a 5x5 Vandermonde system for a 5 point mesh

This is problem 1.2 in Randall J Leveque's textbook, "Finite Di fference Methods for Ordinary and Partial Di fferential Equations". I'm struggling with how to actually do the computation, I'm not so ...
I have a set of ODEs: $$\dot{x}_{i} = f_i(x_1, \ldots, x_N), ~ i \in \{1, 2, \ldots, N\}$$ This set of ODE has the following properties: $\displaystyle\sum_{i=1}^N f_i = 0 ~ \forall x_1, \ldots, ... 0answers 164 views ### How can I write a code for the continued fraction expansion of arctan in matlab using wallis' algorithm? I have already written the following program using wallis' algorithm for continued fraction expansion, but when I compare it to the actual value of arctan the error is high. I thought that there was ... 1answer 60 views ### MATLAB: Approximate tomorrow's temperature with 2nd, 3rd and 4th polynomial using the Least Squares method. The following is Exercise 3 of a Numerical Analysis task I have to do as part of my university course on the subject. Find an approximation of tomorrow's temperature based on the last 23 values ... 1answer 108 views ### Solve nonlinear equations: variables with degree six and degree eight. Suppose I have two nonlinear equations with two variables$\ell$and$m$; the variables$\ell$and$mare of degree eight in the first equation and of degree six in the second equation. How it ... 1answer 673 views ### How to compute elliptic integrals in MATLAB I need to calculate the complete elliptic integrals of the first and second kind , the incomplete elliptic integral of the first kind, and the incomplete elliptic integral of the second kind in ... 1answer 50 views ### What is the best built-in optimizer in Matlab for this problem? I need to optimize $$\sum_{j=1}^p\frac{\sigma^2 \alpha_j^2}{\sigma^2+\delta_j^2\alpha_j^2}-\frac{\left(\displaystyle\sum_{j=1}^p \displaystyle\frac{\sigma^2 ( \delta_j^2 \alpha^2 - ... 1answer 154 views ### Using Romberg integration with improper integral I'm trying to write a MATLAB function that implements Romberg's method of integration. Problem is that I'm trying to approximate:$$\int_0^1\frac{\sin{x}}{x}dxbut the function is not defined at x ... 1answer 80 views ### Numerical integration for integrals 7th order. I need to calculate integral which looks like below, with some numerical method: ... 2answers 346 views ### finite difference method for nonlinear ode I am trying to use finite difference method to solve y'''+y^2y''-y'=0, y(0)=y'(0)=0, y''(1)=1. I let u=dy/dx so the new problem is u''+y^2u'-u=0, u(0)=0, u'(1)=1,y=\int u. To try and solve this ... 1answer 108 views ### Is implementation of method possible? Can I implement the Jacobi and Gauss-Seidel method,at a matrix, even if its determinant equals to zero? I use Matlab and want to find the convergence of the method for the Hilbert matrix. I wanted to ... 0answers 37 views ### Numerical Solvers to deal simultaneously with very different types of Oscillatory Behaviour I am trying to solve these two related problems numerically: \begin{align} &f^{(\mbox{v})}(y) -(f^5 (y))'-\frac{1}{6}yf(y)=0\\ f'(0)=f'''(0)=0, &\quad f(y) \sim Cy^{(-1/7)}\exp(\gamma ... 0answers 176 views ### Runge-Kutta method accuracy I got Runge-Kutta method here and I solve this system using it. So here's Runge-Kutta stuff k_1 = f(t_n, y_n) k_2 = f(t_n + h/2, y_n + hk_1/2) k_3 = f(t_n+h, y_n - hk_1 + 2hk_2) y_{n+1} ... 1answer 335 views ### Writing a MATLAB .m File to Generate a Plot of Absolute Error as a Function of h (step-size) This is the question I am to solve: Given the function f(x)=\ln(3x+1), compute approximations to f'(0) using the centered 3-point formula: f'(x_0)\approx\frac{f(x_0+h)-f(x_0-h)}{2h}. ... 1answer 24 views ### element wise matrix operation problem I am doing an element wise power calculation, and at a given point, I get a complex value out of real values! I have attached a screen shot from the debugging mode in Matlab So, one can see that the ... 2answers 355 views ### Accurate Numerical Integration for unequally spaced data I need to calculate numerical integration of unequally spaced data accurately. For equally spaced data, richardson extrapolation on romberg integral works quite well. ... 1answer 323 views ### MATLAB. Secant Method test. Test the secant method on an example in which r, f'(r) and f''(r) are known in advance. Monitor the ratios e_{n+1}/(e_n e_{n-1}) to see whether they converge to - \frac{1}{2} f"(r) / f'(r). ... 0answers 529 views ### Finite difference approximation of heat equation with source term I am using the implicit finite difference method to discretize the 1-D transient heat diffusion equation for solid spherical and cylindrical shapes. The general equation is: ... 0answers 140 views ### Matlab.Computef(x) = \sin(x) + \cos(x)-1$Write a procedure to compute$f(x) = \sin(x) + \cos(x) - 1$The routine should produce nearly full machine precision for all$x$in the interval$[0, \frac{\pi}{4}]$Hint:$\sin^2 \theta = ...
I was wondering whether there is a faster way to evaluate this double sum in matlab: $$\sum_{n=1}^{\text{max}} \sum_{m=-n}^{n} f(n,m).$$ Cause I am currently doing this with a foor loop over n and m ...