home

some of my matlab functions, GUI apps and scripts
Nasser M. Abbasi, updated Feb 16, 2012

zip files are build such that each is self contained with all the needed matlab files and .fig file (if applicable) to run each application or function from the directory created once the zip file is unziped.

Work in progree, this page is updated all the time.

# code depends on description
1 COMPUTED TOMOGRAPHY, MATHEMATICS AND SIMULATION using Matlab
report and source code
  Image nma_EE518_CT_animation Image animation_backprojection

2 small GUI that starts other 2 GUI's below (not really needed, can just use the GUI's directly below, just did it for fun to try the idea). nma_math228 to start.
nma_math228.m
nma_math228.zip
depends

can be used to start poisson PDE GUI and diffusion PDE GUI.
Image nma_math_228_main_GUI
3 Solve FitzHugh-Nagumo equations on unit square
nma_HW2_math_228B_problem3.m
report is here
nma_HW2_math_228B_problem3.zip
depends Image nma_HW2_math_228B_problem3_ANIMATION_600_seconds_problem_3_part_c Image nma_HW2_math_228B_problem3_ANIMATION_300_seconds_problem_3_part_b
4 GUI application, poisson PDE solver in 2D using a number of finite difference methods: Jacobi, Gauss-Seidel, SOR, direct solver, steepest descent. Support Dirichlet and Neumann boundary conditions and non-uniform grid. Type nma_poisson_GUI to start.
nma_poisson_GUI.m
nma_poisson_GUI.zip
report is here

depends Image nma_poisson_GUI_animation Image nma_poisson_main_screen_shot Image nma_poisson_screen_shot
5 Solve problem 1, HW4, Lax-Wendroff to solve pressure wave equation report and more animation here
nma_math_228b_HW4_parblem_1_part_b.m
nma_math_228b_HW4_parblem_1_part_b.zip
depends Image problem_1_triangle_bounce_off_both_walls Image problem1_part_b_2_sin_bounce_off_LEFT_wall
6 These files make up the lab GUI application spring pendulum
nma_eme_121_lab1.m
nma_eme_121_lab1.zip here is the class report

depends Lab 1, simulation of spring pendulum. EME 121, UC Davis, spring 2011
Image nma_eme_121_lab1_animation Image nma_eme_121_lab1_screen_shot
7 These files make up the GUI application for solving advection PDE, report here


nma_advection_pde_1D.m
nma_advection_pde_1D.zip

depends solves the advection PDE in 1D using Lax-Wendroff, upwind, Lax-Friedrichs, Leapfrog (CTCS), Beam-Warming, Crank-Nicolson, and FTCS( forward Euler, centered space)
Image nma_advection_pde_screen_shot Image nma_advection_pde_1D_screen_shot Image nma_advection_pde_1D_animated
8 These files make up the GUI application simulation of crank-piston. MAE 121, lab3, UC davis, spring 2010
nma_lab3_eme_121_fig.m
nma_lab3_eme_121_fig.zip here is the class report
depends Lab 3, simulation of crank-piston. EME 121, UC Davis, spring 2011
Image nma_mae121_spring_2010_lab3_demo
9 These files make up the GUI application for solving diffusion PDE
nma_diffusion_1d.m
nma_diffusion_1d.zip
depends solves the heat PDE in 1D using explicit (FTCS) and implicit (crank-Nicolson). Also solves the convection diffusion PDE in 1D using FTCS. Periodic, Dirichlet and Neumann boundary conditions.
Image nma_1D_diffusion_final_jan_12_2011 Image nma_diffusion_1D_unstable_case_1
Image nma_diffusion_1D_unstable_case_2 Image nma_diffusion_1D_oscilate_with_source_case_1
10 These files make up the lab GUI application spring pendulum
nma_lab2_eme_121_fig.m
nma_lab2_eme_121_fig.zip here is the class report
depends Lab 2, study the circular disk with mass on spring moving in a slot on the table. EME 121, UC Davis, spring 2011
Image nma_MAE121_spring_2010_lab2_animation
11 These files make up the lab GUI application spring pendulum
nma_lab2_eme_121.m
nma_lab2_eme_121.zip here is the class report
depends Lab 2, study the circular disk with mass on spring moving in a slot on the table. EME 121, UC Davis, spring 2011
12 lab4 GUI application vehicle dynamics, report here report
nma_MAE121_spring_2010_lab4.m
nma_MAE121_spring_2010_lab4Main.m
nma_MAE121_spring_2010_lab4.fig
nma_MAE121_spring_2010_lab4.zip
depends Lab 4, half car model simulation. EME 121, UC Davis, spring 2011
Image nma_MAE121_spring_2010_lab4_animation
13 nma_P2DDIRJCB_S.m
nma_P2DDIRJCB_S.zip
depends matlab script which solves the 2D Poission PDE on unit square using the Jacobian iterative method
14 nma_P2DDIRSOR_S.m
nma_P2DDIRSOR_S.zip
depends solves the 2D poisson on unit square for zero boundary conditions using SOR method
15 nma_PDE_parabolic_explicit_rod_with_rate_BC.m
nma_PDE_parabolic_explicit_rod_with_rate_BC.zip
depends

Solves the parabolic PDE using explicit method for given Boundary expressed as rate
16 nma_TEST_PDE_parabolic_explicit_rod_with_rate_BC.m
nma_TEST_PDE_parabolic_explicit_rod_with_rate_BC.zip
depends tests the above function
17 nma_PDE_parabolic_explicit_rod.m
nma_PDE_parabolic_explicit_rod.zip
depends Solves the parabolic PDE using explicit method for given Boundary fixed conditions (do not change with time)
18 nma_TEST_PDE_parabolic_explicit_rod.m
nma_TEST_PDE_parabolic_explicit_rod.zip
depends tests the above function
19 nma_spline.m
nma_spline.zip
depends takes $(x,y)$ coordinates and computes the cubic splines between them $f(x)=a x^3 + b x^2 + c x + d$
20 nma_test_spline.m
nma_test_spline.zip
depends tests the above functions and makes a plot.
21 nma_185_proj3.m
nma_185_proj3.zip
depends Solve the Lotka-Volterra 2-ODE system. Asks for input from keyboard (rabbits/foxes) and plots population curves
22 nma_euler_heun2.m
nma_euler_heun2.zip
depends function to solve ODE using Euler-Heun algorithm (called also the corrector-predictor method.
23 nma_solve_2D_diffusion_ADI.m
nma_solve_2D_diffusion_ADI.zip
depends Solves the 2D diffusion PDE problem $D (\frac{\partial^2 u}{\partial x^2}+\frac{\partial^2 u}{\partial y^2})=\frac{\partial u}{\partial t} $ on unit square with Neumann boundary conditions. Uses cell centered grid points and uses ADI scheme.
24 nma_test_solve_2D_diffusion_ADI.m
nma_test_solve_2D_diffusion_ADI.zip
depends driver for the 2D ADI solver
25 nma_generate_A_and_ARHS_for_2D_diffusion_Neumman.m
nma_generate_A_and_ARHS_for_2D_diffusion_Neumman.zip
depends This function generates the A and B matrices to use before calling the ADI solver.
26 nma_solve_reaction_ODE.m
nma_solve_reaction_ODE.zip
depends solves the reaction ODE part of the FitzHugh-Nagumo equations
27 nma_solve_gauge_ODE.m
nma_solve_gauge_ODE.zip
depends solves the ode $w_t = epsilson(w-gamma*w)$, part of problem 3, HW2
28 nma_gen2Ddirch.m
nma_gen2Ddirch.zip
depends 2D dirchilet for Poisson
29 nma_verify_valid_positive_numeric.m
nma_verify_valid_positive_numeric.zip
depends utility function. verifies a number is numeric and positive
30 nma_verify_valid_positive_integer.m
nma_verify_valid_positive_integer.zip
depends utility function. verifies a number is integer and positive
31 nma_verify_valid_non_negative_numeric.m
nma_verify_valid_non_negative_numeric.zip
depends utility function. verifies a number is non negative
32 nma_verify_valid_numeric.m
nma_verify_valid_numeric.zip
depends utility function. verifies a number is numeric
33 nma_evaluate_1D_function.m
nma_evaluate_1D_function.zip
depends utility function. evaluates a function passed as string on 1D grid
34 nma_c2f.m
nma_c2f.zip
depends utility function, This function is the prologation operator which implements coarse to fine grid bilinear interpolation mapping
35 nma_f2c.m
nma_f2c.zip
depends utility function, The restriction operator which implements the fine grid to a coarse grid full weight mapping on 2D
36 nma_GENP2D.m
nma_GENP2D.zip
depends generate A system matrix, and vector f for the problem Au=f, to solve for u on 2D. A is Poisson discrete A matrix based on use of standard 5 points laplacian.
37 nma_solver_Vcycle.m
nma_solver_Vcycle.zip
depends This function does one iteration relaxation, called by V cycle for multigrid solver of the 2D Poisson PDE On unit square.
38 nma_relax.m
nma_relax.zip
depends This function does one iteration relaxation, called by V cycle for multigrid solver of the 2D Poisson PDE On unit square.
39 nma_solver_Vcycle.m
nma_solver_Vcycle.zip
depends solve poisson 2D pde on unit square with zero boundary conditions using multigrid V cycle method. This function sets up cycle, then calls nma_V_cycle() to actually perform the cycle computation in a loop until convegence
40 my implementation of LU Decomposition and Linear Solver using Matlab
see report and code here
   
41 Small Matlab GUI untility to change units of a Matlab .fig file. Make sure to save a copy of your fig file before using, just in case.
see report and code here
   
42 nma_V_cycle.m
nma_V_cycle.zip
depends Implement multigrid V Cycle to solve 2D poisson PDE
43 nma_ISSYM.m
nma_ISSYM.zip
depends checks that matrix is symmetrix or not
44 nma_ISSPD.m
nma_ISSPD.zip
depends checks that matrix is spd or not
45 nma_validate_dimensions_1.m
nma_validate_dimensions_1.zip
depends utility function Verifies that grid is power of 2 plus one size. Verfies that grid is 2D and square for the Poisson PDE solver
46 nma_validate_dimensions.m
nma_validate_dimensions.zip
depends utility function Verifies that grid is power of 2 plus one size. Verfies that grids are 2D and square, and that dimensions match for the Poisson PDE solver
47 nma_check_all_zero_boundaries.m
nma_check_all_zero_boundaries.zip
depends utility function verifies that boundary conditions are zero for the Poisson PDE solver
48 nma_find_norm.m
nma_find_norm.zip
depends utility function called from number of places to find the grid norm for the Poisson PDE solver
49 nma_find_residue.m
nma_find_residue.zip
depends utility function called from number of places to find the grid norm for the Poisson PDE solver
50 nma_P2DDIRSOR.m
nma_P2DDIRSOR.zip
depends Solve the 2D poisson PDE on unit square with Dirichlet B.C using SOR method
51 nma_FDM_matrix_laplace_1D_Neumann_scheme_1.m
nma_FDM_matrix_laplace_1D_Neumann_scheme_1.zip
depends utility function returns the A matrix, which is the system finite difference matrix for numerical solution of 1-D laplace equation $\frac{\partial^2 u}{\partial x^2}=f(x) $ with Nuemman boundary conditions on both sides of the element
52 nma_FDM_matrix_laplace_1D_Neumann_scheme_2.m
nma_FDM_matrix_laplace_1D_Neumann_scheme_2.zip
depends utility function returns the A matrix, which is the system finite difference matrix for numerical solution of 1-D laplace equation $\frac{\partial^2 u}{\partial x^2}=f(x) $ with Nuemman boundary conditions on both sides of the element
53 nma_FDM_matrix_laplace_1D_dirichlet.m
nma_FDM_matrix_laplace_1D_dirichlet.zip
depends

utility function returns the A matrix, which is the system finite difference matrix for numerical solution of 1-D laplace equation $\frac{\partial^2 u}{\partial x^2}=f(x) $ with Dirichlet boundary conditions on both sides of the element
54 nma_FDM_matrix_laplace_1D_robin.m
nma_FDM_matrix_laplace_1D_robin.zip
depends utility function returns the A matrix, which is the system finite difference matrix for numerical solution of 1-D laplace equation $\frac{\partial^2 u}{\partial x^2}=f(x) $ with Nuemman boundary conditions on both sides of the element
55 nma_RK4.m
nma_RK4.zip
depends Function to solve 1st order ODE using Runge-Kutta classical 4th order
56 nma_romberg.m
nma_romberg.zip
depends generate the Romberg integration table
57 nma_test_romberg.m
nma_test_romberg.zip
depends driver for the above function
58 nma_trapezoidal.m
nma_trapezoidal.zip
depends integrates a function using trapezoidal rule using specific number of strips
59 change_figure_units/index.htm N/A mall untility to change units of a Matlab .fig file
60 nma_math_228b_HW4_problem_3.m
nma_math_228b_HW4_problem_3.zip
depends This function solves problem 3 HW 4 for Math 228B, UC Davis, winter 2011 It solves the diffusion problem $u_t + a u_x = 0$ using finite volume method with the use of flux limiter functions
61 nma_get_index.m
nma_get_index.zip
depends utility function,called from number of places to obtain the residue for the Poisson PDE solver
62 nma_zoom_image.m
nma_zoom_image.zip
depends zooms an image by factor k using nearest neighbor algorithm
63 nma_set_figure_position.m
nma_set_figure_position.zip
depends called to create a figure in middle of window
64 nma_SD.m
nma_SD.zip
depends solves Au=f using the method of steepest descent
65 nma_math228b_HW2_prob2.m
nma_math228b_HW2_prob2.zip
depends implements the refinement study for HW2 for Math 228B UC Davis, Winter 2011
66 matlab class nma_math228b_HW2_prob2.m
nma_math228b_HW2_prob2.zip
depends Class to implement the Lax-Wendroff scheme to solve advection PDE in 1-D
67 nma_testLaxWendroff.m
nma_testLaxWendroff.zip

depends driver to test the above class
68 nma_format_matrix.m
nma_format_matrix.zip
depends prints matrix of numerical data with headings in formatted way
69 nma_EULERH.m
nma_EULERH.zip
depends Function to solve ODE using Euler-Heun algorithm (called also the corrector-predictor method)
70 nma_CG.m
nma_CG.zip
depends solves Au=f using the method of conjugate gradient with pre-conditioning
71 nma_TEST_CG.m
nma_TEST_CG.zip
depends driver for the nma_CG.m
72 nma_test_CG_GUI.m
nma_test_CG_GUI.zip
depends simple GUI front end to the nma_CG() solver, to solve 2D poisson problem using conjugate gradient method with preconditioning
73 nma_TEST_CG_2.m
nma_TEST_CG_2.zip
depends another function to test nma_CG.m this compares my solution with that found by matlab pcg() function
74 matlab class refinement_study_manager.m
refinement_study_manager.zip
depends This class is used for doing refinement study for my math 228 numerical pde class
75 nma_laplaceRectNuemann.m
nma_laplaceRectNuemann.zip
depends solves the laplace PDE for rectangular region for Nuemann boundary conditions at the bottom edge only
76 nma_laplaceRectDirchletBendCorner.m
nma_laplaceRectDirchletBendCorner.zip
depends solves the laplace PDE for rectangular region for Dirclet boundary conditions with the lower left corner bend per parameters alpha and beta
77 nma_laplaceRectDirchlet.m
nma_laplaceRectDirchlet.zip
depends solves the laplace PDE for rectangular region for Dirclet boundary conditions
78 nma_inputNumeric.m
nma_inputNumeric.zip
depends generic function that reads a numeric number from user and keeps trying untill the user types in correct value
79 nma_euler_midpoint.m
nma_euler_midpoint.zip
depends solve ODE using Euler-mid-point algorithm
80 nma_findAlphaForMinDeltaV.m
nma_findAlphaForMinDeltaV.zip
depends Finds the minumum alpha (initial inclincatin correction) for an orbit relative to a larger circular orbit. see design note for more detailes
81 nma_testfindAlphaForMinDeltaV.m
nma_testfindAlphaForMinDeltaV.zip
depends driver to test the above function
82 nma_findPointOnLine.m
nma_findPointOnLine.zip
depends find how many steps needed to reach withing tolearance close to a point on a line by taking fixed number of steps. Line wrapes around
83 nma_getDeltaTimeFromDeltaNu.m
nma_getDeltaTimeFromDeltaNu.zip
depends calculates the delta time, or the time of flight, for the orbit moving from nu0 to nu. It does this calculations for any one of the 4 conic sections
84 nma_getFlux1.m
nma_getFlux1.zip
depends used somewhere, need to find out
85 nma_getOrbitParams.m
nma_getOrbitParams.zip
depends Finds orbit parameters from the velosity and position vectors
86 nma_getUniversalVariable.m
nma_getUniversalVariable.zip
depends compute the Universal Variable X for an orbit
87 nma_moveProbe.m
nma_moveProbe.zip
depends Moves a probe in an orbit for deltaTime from a starting position and velosity vectors, and returns the new position and veclosity vectors
88 nma_orbit_simulator.m
nma_orbit_simulator.zip
depends GUI m file for my orbit simulator project for a class at UCI. need the fig file below
89 nma_rocket_design.m
nma_rocket_design.zip
depends design rocket from earth to GEO final project MAE 146 at UCI
90 nma_rocket_design_PERMUTE.m
nma_rocket_design_PERMUTE.zip
depends some variation of the the above design
91 nma_rocket_getLagrangeMultiplier.m
nma_rocket_getLagrangeMultiplier.zip
depends Solves equation 5.57 in the book orbital mechanices page 96, by Prussing and Conway
92 nma_rocket_mutliStageSolutionLagrange.m
nma_rocket_mutliStageSolutionLagrange.zip
depends design for a multi-stage rocket.Finds the mp, ms, lambda, and the Z for each rocket stage based on optimization based on using the lagrange multiplier method
93 nma_rocket_solveRocketEquationOneStage.m
nma_rocket_solveRocketEquationOneStage.zip
depends Solves for Mp (mass of properellent) and Ms (mass of structure) for a given one stage rocket.
94 nma_rocket_solveRocketEquationOneStage_form2.m
nma_rocket_solveRocketEquationOneStage_form2.zip
depends Solves the rocket equation for delta V given Mp (mass of properellent) and Ms (mass of structure) and mL (payload) and Isp and epsilon for a one stage rocket.
95 nma_rocket_solveRocketEquationOneStage_form3.m
nma_rocket_solveRocketEquationOneStage_form3.zip
depends Solves the rocket equation for delta V given Mp (mass of properellent) and Ms (mass of structure) and mL (payload) and Isp
96 nma_runProbeSimulation.m
nma_runProbeSimulation.zip
depends runs a simple simulation of a probe starting from some position and velosity vector for some delta time.
97 nma_solveProb_43.m
nma_solveProb_43.zip
depends solves a problem, need to document
98 matlab class nma_spring.m
nma_spring.zip
depends static class to make spring for plotting animations
99 matlab handle class rect_pulse_on_periodic_1D.m
rect_pulse_on_periodic_1D.zip

depends implements the rectangular pulse, which is used in implementation of HW3, Math 228B
100 nma_lap1d.m
nma_lap1d.zip
depends generate 2D matrix A for poisson 3D
101 nma_lap2d.m
nma_lap2d.zip
depends generate 1D matrix A for poisson 3D
102 nma_lap3d.m
nma_lap3d.zip
depends generate 3D matrix A for poisson 3D



me 2012-02-22