Tag Info

0

Normally, Matlab does not know that your $t$ is the time, i.e., that it is real. And by default it assumes that $t$ is complex. If you want to tell to Matlab that the variable is real, then define it as syms t real Then pretty(simplify(expm(A*t))) returns / / pi \ \ | sqrt(2) exp(-2 t) cos| t + -- |...

2

Every non-zero complex number has two square roots: if $w^2=z$, then $(-w)^2=z$ too. You found one square root one way, and one the other. (The program gives you only one each time.)

2

Let us introduce the vector ${\bf U} = (\theta, \eta)^\top$ of unknowns. Since $\partial_t {\bf U}$ is nonlinear in ${\bf U}$, the Crank-Nicolson method requires to invert the nonlinear algebraic system $F_\Delta (\theta,\eta) = 0$ from Eq. (30) at each time step. This step provides the updated values ${\bf U}_m^{n+1}$ from the current values ${\bf U}_m^{n}$....

0

You start with an empty set of column vectors. Then you iterate over columns in matrix $A$. If the column can be expressed as a linear combination of the vectors in the set, you skip the vector. Otherwise you add the vector to the set and continue. After you get n linearly independednt vectors, it is the matrix you are looking for.

1

These $n$ columns will form a basis of the column space of $A$. If you perform a row reduction the columns containing a leading $1$ will form such a basis. If you use the Matlab command [R,p] = rref(A) the indices of those columns should be returned in p.

1

The central block of T defines a matrix that gives the complex eigenvalues of A eig(T(2:3,2:3)) ans = 1.9202 + 1.4742i 1.9202 - 1.4742i

1

Partial answer (because I don't remember the details): Many years ago, I made an animation of a coherent state quantum harmonic oscillator in MATLAB. I don't remember the exact commands, and the script is on a computer I unfortunately no longer have access to (I had not yet heard about Github). What I did was to draw every frame in a for-loop, and save as ...

0

Hint: For $\dfrac{d^2y}{dt^2}+\dfrac{t^2+t+1}{t^3+2}\dfrac{dy}{dt}+\dfrac{t^4}{t+2}y=0$ Let $r=\dfrac{1}{t}$ , Then $\dfrac{dy}{dt}=\dfrac{dy}{dr}\dfrac{dr}{dt}=-\dfrac{1}{t^2}\dfrac{dy}{dr}=-r^2\dfrac{dy}{dr}$ $\dfrac{d^2y}{dt^2}=\dfrac{d}{dt}\left(-r^2\dfrac{dy}{dr}\right)=\dfrac{d}{dr}\left(-r^2\dfrac{dy}{dr}\right)\dfrac{dr}{dt}=\left(-r^2\dfrac{d^2y}... 0 It can be written with some complicated expressions, but I don't know whether you think it would be an improvement: wx = hx/3*[1 4 reshape([2;4]*ones(1,floor((Nx-3)/2)), ... 1,[]) 1 zeros(1,mod(Nx+1,2))]+... mod(Nx+1,2)*hx/24*[zeros(1,2*floor((Nx-3)/2)) ... 1 -5 19 9*ones(1,mod(Nx+1,2))]; wy = hy/3*[1 4 reshape([2;4]*ones(1,floor((Ny-3)/2)), ... ... 0 $$\frac{d(m_0V)}{dt}=BV$$ since$m_0$and$B$are constants we can say: $$m_0\frac{dV}{dt}=BV$$ we can now rearrange this to say: $$\frac 1V\frac{dV}{dt}=\frac{B}{m_0}$$ Now just integrate both sides: $$\int\frac 1V\frac{dV}{dt}dt=\int\frac{B}{m_0}dt\Rightarrow\ln|V|=\frac{B}{m_0}t+C$$ Now exponentiate both sides: $$V=e^Ce^{\frac{B}{m_0}t}$$ Now notice that ... 1 The columns$\mathbf h_i$of a transformation matrix$H$are the images of the basis vectors expressed in coordinates relative to the “output” basis. If Hpw is an affine transformation matrix that converts from local to global coordinates, then its first three columns are the directions of the local coordinate axes expressed in global coordinates, while the ... 0 $$y''(t)+p(t)y'(t)+q(t)y(t)=0$$ Analytical solving of this general linear second order ODE is a much too wide question, even if$p(t)$and$q(t)$are not any kind of functions, but polynomial fractions. For a general approach see : http://mathworld.wolfram.com/Second-OrderOrdinaryDifferentialEquation.html If you don't want a closed form solution, you can ... 1 If$B,m_0are constants, then $$m_0\frac{d V}{dt} = BV$$ or $$\frac{d V}{V} = \frac{B}{m_0}dt$$ Integrating both sides as $$\int \frac{d V}{V} =\int \frac{B}{m_0}dt$$ will give you $$\ln V = \frac{B}{m_0}t + K$$ which is equivalent to $$\exp(\ln V) =\exp( \frac{B}{m_0}t + K) =\underbrace{ \exp( K) }_C\exp( \frac{B}{m_0}t)$$ Finally you get V = C \... 0 What you are trying to do will never work. You are given conditions on the values of the solution at two different points, a boundary value problem. There is, trivially, no bijective map of the time domain that will map both points on the same one to get an initial value problem. "Two points map to one" is a contradiction to "bijective". You will have to ... 0 Instead of trying to directly use ode45, do it as a root-finding problem: finding y(0)=y_0 so that y(T)=y_T when you solve the ODE. 1 Unknowns 50+9+3=62 and equations 50\cdot2256=112800 - this overdetermined system. System may reduced by delete a_1,a_2,a_3: link. 1 You could try gradient descent. Btw setting all the a values to zero seems to work 1 Let \begin{align*} \mathbf{x}&:=\mathbf{x}(t)= \begin{bmatrix} x_s & x_m & v_s & v_m \end{bmatrix}^T,\\ A&:= \begin{bmatrix} 0 &0 & - 1& 0 \\ 0& 0 &0 & -1 \\ \frac{K_{s1} + K_{s2}}{m_s} & -\frac{K_{s2}}{m_s} & \frac{R_{s1} + R_{s2}}{m_s} & -\frac{R_{s2}}{m_s} \\ -\frac{K_{s2}}{m_s} & \frac{K_m + K_{... 0 I'm going to use primes instead of dots for derivatives. I'm going to introduce new letters to stand for your basic functions and their derivatives: u will stand for x_s, v for x_s', w for x_m, and z for x_m'. Then your equations can be rewritten in the form u'=v, v'=au+bv+cw+dz+e, w'=z, z'=fu+gv+hw+iz+j for some constants a,b,c,d,e,... 1 You can use the SVD. Let M = U \Sigma V^{T}. Then if you consider the problem least squares problem \min_{x} \| Mx - b\|_{2}^{2} $$we get$$ \| Mx - b\|_{2}^{2} = \|U^{T} (M VV^{T} x - b)\|_{2}^{2} = \| \Sigma V^{T}x - U^{T}b\|_{2}^{2}$$You can compute this like$$ x^{*} = V \Sigma^{-1}U^{T}b $$with$$ \Sigma^{-1} = \begin{align}\begin{... 0 SoMx =b$has infinitely many solutions. One approach is that you could find the least norm solution by multiplying both sides by the pseudoinverse of$M. 2 To solve 2D quasilinear systems of conservation laws $${\bf u}_t + {\bf A}({\bf u})\, {\bf u}_x + {\bf B}({\bf u})\, {\bf u}_y = {\bf 0}$$ numerically, various strategies can be followed: Implement a 2D finite-volume scheme, such as the 2D Lax-Friedrichs method \begin{aligned} {\bf u}_{i,j}^{n+1} &= \frac{{\bf u}_{i-1,j}^{n} + {\bf u}_{i+1,j}^{n} + {\... 0 You can find coefficients of Lagrange interpolation polynomial relatively easy if you use a matrix form of Lagrange interpolation presented in "Beginner's guide to mapping simplexes affinely", section "Lagrange interpolation". General formula looks as follows\$ f(x) = (-1) \frac{ \det \begin{pmatrix} 0 & f_0 & f_1 &...

Top 50 recent answers are included