Matlab code
clc
clear all
n=10;
h=1/n;
x=0:h:0.9;
x=x'
A=full(gallery('tridiag',n,-1,2,-1))
v=zeros(n,1);
for k=1:20
v=-h.^2*inv(A)*(3*v+x.^2+10*v.^3);
end
%end
v
Output
x =
0
0.1000
0.2000
0.3000
0.4000
0.5000
0.6000
0.7000
0.8000
0.9000
A =
2 -1 0 0 0 0 0 0 0 0
-1 2 -1 0 0 0 0 0 0 0
0 -1 2 -1 0 0 0 0 0 0
0 0 -1 2 -1 0 0 0 0 0
0 0 0 -1 2 -1 0 0 0 0
0 0 0 0 -1 2 -1 0 0 0
0 0 0 0 0 -1 2 -1 0 0
0 0 0 0 0 0 -1 2 -1 0
0 0 0 0 0 0 0 -1 2 -1
0 0 0 0 0 0 0 0 -1 2
v =
-0.0048
-0.0098
-0.0149
-0.0201
-0.0250
-0.0291
-0.0315
-0.0313
-0.0271
-0.0173
5. (20 points) Prepare the necessary equations by hand and create a matlab script that solves the follo- wing non-l...
DO THIS IN MATLAB PLEASE DO THIS IN MATLAB Create a script file that performs the following calculations. Your script will use the functions you create. Label all graphs appropriately. For this project, do not have your homemade functions fprintf anything, instead have all your fprintf commands within your script. Attach your published script file along with .m files for your functions. Exercise 1. A fundamental iterative method for finding the roots of equations of one-variable is known as Newton's...
Could someone explain these four promblems on matlab and if you do, could you write what you wrote on matlab I.e. on the command window or script. Also if you have written anything by hand can you write neatly. Also an explain of how you did it would be greatly appreciated. 1] 5 points) Write the following set of equations in Matrix form and use Matlab to find the solution. 50 -5x3-6x2 2x2 + 7x3-30 x1-7x3-50-3x2 + 5x1 [2] (10...
4. (20 points) Prepare the finite difference equation set necessary to solve the linear boundary value problem with n-5: 4. (20 points) Prepare the finite difference equation set necessary to solve the linear boundary value problem with n-5:
MATLAB Problem HW7P2 (20 points) (5 pts) Write a user-defined MATLAB function called HW7P2_fn for the following math function 3 o-0.47x The input to the function is x and the output is y. Write the function such that x can be an array (use element-by-element operations) (15 pts) Use the function in (a) the command window to calculate y(-2) and y(5) (b) a script file HW7P2.m to determine y(x) for 0.001 Sx S 10 with 1000 points. Hint: Use the...
For this project, each part will be in its oun matlab script. You will be uploading a total 3 m files. Be sure to make your variable names descriptive, and add comments regularly to describe what your code is doing and hou your code aligns with the assignment 1 Iterative Methods: Conjugate Gradient In most software applications, row reduction is rarely used to solve a linear system Ar-b instead, an iterative algorithm like the one presented below is used. 1.1...
Linear Algebra Matlab exercise: 1. (20 points total) Let -6 28 211 A=14-15-12 L-8 32 25 Write a script that (a) (5 points) Computes and prints on the screen the eigenvalues of A (b) (10 points) Without using eig command, computes and prints on the screen bases for the eigenspaces corresponding to each of the distinct eigenvalues of A (c) (5 points) Plots p(t) (e) (5 points) Plots det(A tI), the characteristic polynomial of A, as a function of t...
Name: UIN: Course No 4. (20 points, 5 points each) Two finite length signals, nijej and rlel are given Let y(n] be the linear convolution of a ej and lal (a) Detemine yin) (b) Ifwe execute the following Matlab script to get yiin what is ynn List all values in y(n) p-ifftfh,8).h,8)),8)% (hint: 8-point circular convolution) (c) Ifwe execute the following Matlab script to get yinl what is ylm? List all values in yin n- ifhiiff,10)ffhc,10)),10)(hint: 10-point circular convolution) Write...
please write code in MATLAB as well 5. (12 points) Create the following signal in Matlab: x[n] = u(n) - u[n-6] a. Mathematically compute yi[n] = x[n] * x[n] where * means convolution. Now use the conv command to perform the convolution. Graph x[n) and the resulting y(n), both over the interval Osns 20. How many non-zero terms does y(n) have? Does your computational result agree with the Matlab result? b. Repeat a. but this time with yz[n] = x[n]*h[n)...
MATLAB (2 points) Challenge. Create a SCRIPT file called thirdOrderDE.m 5) Blasius showed in 1908 that the solution to the incompressible flow field in a laminar boundary layer on a flat plate is given by the solution of the fol- lowing third-order ordinary nonlinear differential equation Rewrite this equation into a system of three first-order equations, using the following substitutions: h,(m) = f d2 Solve using the ode45 function with the following initial conditions: hi (0) = 0 hs(0) =...
On Matlab: Use both X=A\b and X=inv(A)∗b to find x,y,z. Use tic toc to time each method. Then create a general solver to solve any linear system of n equations and n unknowns of the form AX = b. Allow the user to input the n×n matrix A and n×1 column vector b. Use X = A\b to solve the system in your script and display the solution to the user. Try your solver with A = randi(50, 10), b...