Borrar filtros
Borrar filtros

does anyone have the "leap frog" algorithm matlab script?plz help i need it!

7 visualizaciones (últimos 30 días)
RoMeO
RoMeO el 14 de Dic. de 2013
Comentada: Steven Lord el 24 de Nov. de 2021
leap frog matlab script or matlab code is what i need

Respuestas (3)

Walter Roberson
Walter Roberson el 14 de Dic. de 2013
Google can find SFLA MATLAB code. I have no idea of the quality of it, and I have no idea whether it is legitimate code or will delete everything on your hard disk.
I would keep in mind that if you are doing an assignment or project, that you cannot copy someone else's code.
  4 comentarios
Vaibhav
Vaibhav el 1 de Feb. de 2014
i created my account in that link still not able to download.

Iniciar sesión para comentar.


T S Singh
T S Singh el 5 de Mayo de 2016
Editada: T S Singh el 5 de Mayo de 2016
You can try the following code. Its an application of Leap Frog Algorithm applied to Simple harmonic Motion
close all
clear all
clc
x(1) = 0.0; % initial position
v(1) = 2.0; % initial velocity
del_t = 0.2; % time increment
k = 0.1; % spring constant
m = 1.0; % mass
Tf = 100.0; % Final time
t = 0:del_t:Tf;
N = length(t);
v_hlf(1)=v(1)+(0.5*del_t*(-k/m)*x(1));
for j=2:N
x(j)=x(j-1)+v_hlf(j-1)*del_t;
v(j)=v_hlf(j-1)+0.5*(del_t*(-k/m)*x(j));
v_hlf(j)=v(j-1)+0.5*(del_t*(-k/m)*x(j));
end
figure; plot(t, x);
grid on;

João Socorro Pinheiro Ferreira João Ferreira
resolver:
O arquivo-m advection\_LW\_pbc.m implementa o método Lax-Wendroff para a equação advecção em $0 \leq x \leq 1$ com condições de contorno periódicas.
\begin{itemize}
\item [(a)] Modifique o arquivo.m para criar uma versão advection\_lf\_pbc.m implementando o leapfrog e verifique se isso é preciso de segunda ordem. Observe que você terá que especificar dois níveis de dados iniciais. Para o conjunto de teste de convergência $U_j^1 = u (x_j, k)$, a solução verdadeira em tempo $k$.
\item [(b)] Modifique advection\_lf\_pbc.m para que os dados iniciais consistam em um pacote de ondas
\begin{equation}
\eta (x) = \exp{(-\beta (x - 0.5)^2}\sin{(\xi x)} \hspace{1.5cm} (Ex. 10.9a)
\label{011121b}
\end{equation}
Descubra a verdadeira solução $u (x, t)$ para esses dados. Usando $\beta = 100$, $\xi = 80$ e $U_j^1 = u (x, k)$, teste se seu código ainda exibe uma precisão de segunda ordem para $k$ e $h$ suficientemente pequena.
\item [(c)] Usando $\beta = 100$, $\xi = 150$ e $U_j^1 = u (x_j, k)$, estime a velocidade do grupo do pacote de onda
calculado com leapfrog usando $m = 199$ e $k = 0.4h$. Quão bem isso se compara com o valor (10.52) predito pela equação modificada?
\end{itemize}
  1 comentario
Steven Lord
Steven Lord el 24 de Nov. de 2021
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.

Iniciar sesión para comentar.

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by