Download Computational Project for MATLAB: Defining Vectors, Matrices, and Plotting Functions - Pro and more Study Guides, Projects, Research Mechanical Engineering in PDF only on Docsity! Computational Project # 1 Due February 12 1. Develop, debug, and test a program (MATLAB m-file) that for arbitrary m and n (input parameters): a) Defines vector 1 , 1, 1i ix i m − = = − …m using single loop. b) Define vector ( )11 1 cos , 1, 2 1j j y n π − = − = − …j n using Matlab vector operations instead of using loop. c) Define two-dimensional array ( ) 21 sin , 1, , 1, 2ij i j y i m jπ = − = = …a x using double loop. n… d) Define two-dimensional array 4 41 2 , 1, , 1, 4 3ij i j y i m j = − + − = = … …b x using “meshgrid” Matlab command instead of using double loop. n e) Use subplot command to break the figure window into a 2-by-2 matrix of smaller sub-windows. f) Plot y vs. x in first sub-window if n=m, otherwise create an empty figure with axes and domain size defined x and y vectors and write an error message “Error: n/=m”. Define the names for the axes using on-line commands and the figure title. Create legends. g) Plot two-dimensional array aij as 3-dimensional surface. Use two different styles for the surface: “shading interp” and “shading faceted” for two other sub-windows. h) In the forth sub-winow create a filled contour plot of two-dimensional array bij. Use jet as a colormap. For items (a)-(g) create a single function that performs all the tasks with n and m as input parameters. Run and test the program for (n,m)=(11,11), (21,11) . 2. Using the Symbolic Math Toolbox create, debug, and test another program (MATLAB m-file) that a) finds first 5 terms of Taylor series expansion for ( )2cos tan 4x x π − about x=0. b) differentiates the function ( ) 2sintan sin( ) xx e P.S. Email your code to compmeth@colorado.edu. The program that you send should be a working program All the codes will be checked whether they run or not. If they are erroneous, but run, points will be taken for the errors. If the code is not running (it has some syntax errors), an additional 25% will be taken out. The goal of this class is for you to be comfortable solving engineering problems. Please take your time and learn how to trust the computer.