Create a flowchart showing the logic of your code

Assignment Help MATLAB Programming
Reference no: EM131288370

Assignment: Introduction to Programming in MATLAB

Submission Instructions: Your solutions to this assignment must be typed and neatly presented. Unorganized solutions and/or solutions that do not present the required deliverables will not be graded and receive a score of zero. This assignment is to be submitted, in PDF format, to the assignment link on blackboard by the deadline.

Students who obtain a score of 80% or greater on this project will receive credit for all course outcomes.

1. Part 1 - "For" and "While" loops in MATLAB

i. Consider the approximation for sin(x) given in homework as:

sin x = x - x3/3! + x5/5! - x7/7! + x9/9! - x11/11! + x13/13! - x15/15! + x17/17!

Create a vector where each element is a term of the series. Allow the user to input the value of x (as a scalar). Sum the terms of the series using a "for" loop and create a formatted output to show the user (1) the value of the approximation, (2) the actual value of sin(x) (from the MATLAB function) and (3) the error between the two. Use values x = 2, 2.5, 3 to compare.

ii. Now consider the generalized form of the Taylor series for sin(x):

sin x = n=0(-1)n [x2n+1 / (2n + 1)!]

Sum the first 100 terms of the series and show the result as a formatted output identical to that of 1(i). Allow the user to input the value of x as a scalar. Repeat this problem with the first 250 terms. Compare the results. (Use same x values as from (i)).

iii. How many terms are required in (iii) to reduce the relative error to less than 1%? 0.00001%?

Assume that the relative error (percent) is defined as:

% Error = |(St - Sn) / St| × 100

St = sin x, St = n=0(-1)n [x2n+1 / (2n + 1)!]

where St and Sn are the true and numerical solutions, respectively. The "numerical" solution will come from the summation of terms while the true solution can be obtained using the built-in MATLAB function for sin(x). Each iteration through the loop, create a formatted output that shows (1) the iteration number, (2) the number of terms in the series and (3) the percent error between the obtained values. The output printed during the loop should be done so that a new line is created each time a new output is printed. When the loop has completed, display the result, the final percent error, and the number of terms using a single command. Save the percent error per iteration and plot % error vs. iteration when the loop has completed.

iv. For (iii), create a flowchart showing the logic of your code. Considering that this is the course project, please be sure to create this flowchart in a word editor (i.e. it must be typed!).

2. Part 2 - Processing data with MATLAB

i. Consider the 3 text files labeled "aluminum_test", "5_MIL_test" and "2_MIL_test" that are uploaded and attached to the assignment link. This data was collected when running Arizona State University's shocktube during an AEE 362 (High Speed Aerodynamics) laboratory experiment . The tests show data for 3 different shock wave experiments where shocks of different strengths were intentionally generated. Note that the first two columns represent pressure data (reported in psi) and that columns 3 and 4 show pressure data in units of Volts. Therefore, the data in columns 3 and 4 must be converted to useful units before it can be plotted. The conversion is given below, giving you a result in PSI.

PSI = 0.0418 x mV

Your task is to:

a. Load this data into MATLAB (hint: load() - you may also need to remove the text at the top of the data file).

b. Find the total time of the dataset, noting that the time between data points is 0.025 ms.

c. Add 14.0 to all the values in the second column. Plot this data together with that of the first column vs. time. Knowing that this is pressure, what appears to be happening?

d. Plot the data in columns 3 and 4 vs. time, after this data has been converted to PSI. These sensors were mounted inside the tube and represent changes in pressure over time. What can you see from the data? (quick comment)

e. The distance between the two pressure transducers is given as 48(1/32) in. Knowing this, we can use the "peaks" from the data in the plot from (d) (showing two changes in pressure at two different locations) to calculate the speed of the resulting shockwave. After generating the plot, use the "cursor tool" and find the Δt between the two peaks (you may also need to zoom- in considering it is the first two peaks we are interested in). The velocity of the wave can then be calculated using:

Δx / Δt

where Δx is the distance between pressure sensors. Compare shock speeds between the materials (no comments/analysis needed - but look at the results!). The material strengths are in the order: 5 Mil, 2Mil, Aluminum.

Reference no: EM131288370

Questions Cloud

The strong global brand equity of swiss army : Which factors are attributable to the strong global brand equity of Swiss Army?- What are the main motives behind the product line extension from Swiss Army knives into other product areas?
Explain why the price of superconductors : Explain why the price of superconductors has diminished in the short run. How does a superconductor manufacturing company's output correlate with the quantity of labor in the short run? Calculate a long-run average cost curve for superconductors.
What implications does the product life cycle theory have : How would you distinguish between services and products? What are the main implications of this difference for the global marketing of services?
Name two government policy actions : Name two government policy actions which caused, or made worse, the Great Depression; and one that caused, or made worse, the Great Recession. (You can be brief)
Create a flowchart showing the logic of your code : For (iii), create a flowchart showing the logic of your code. Considering that this is the course project, please be sure to create this flowchart in a word editor (i.e. it must be typed!).
Describe briefly the iplc theory : Describe briefly the IPLC theory and its marketing implications.-  What are the requirements that must be met so that a commodity can effectively be transformed into a branded product?
View of exchange in neoclassical economic theory : How does Adam Smith's account of division of labour and exchange challenge the view of exchange in neoclassical economic theory?
Packaging decisions for international product lines : Discuss the factors that need to be taken into account when making packaging decisions for international product lines.
Provide public goods such as national defense : Taxes can be justified if the government uses the revenue to (i) Provide public goods such as national defense. (ii) Clean up negative externalities such as water pollution

Reviews

Write a Review

MATLAB Programming Questions & Answers

  Evaluate the median and convolution filters to reduce noise

Evaluate the median and convolution filters to reduce noise while preserving edges. Study the behavior of various 3x3 convolution filter kernels for smoothing, edge detection, and sharpening

  Anatomy of a machine

Need a Machine Learning application written in matlab to be able to predict, based on certain selected features of wine, which variants of wine are likely to score above a 5 out of 10 quality score.

  Use backslash matlab operator for solving the systems

The programme solves a linear system of equations using naïve Gaussian elimination. Modify this programme so that it outputs upper and lower triangular matrices of LU factorisation.

  Time domain design and analysis

To design a "custom" controller to reduce the vibrations of the seat and a PID controller to reduce the vibration of the seat

  Write a matlab function called newtons method

Write a MATLAB function called newtons Method that accepts two inputs and returns one output. The inputs should be a vector representation of a polynomial and an initial guess for the root.

  Write a script that simulates a casino machine

Write a script that simulates a casino machine. To play a single round on the machine user pays $ 5. Now when the user start the machine, the machine rolls a pair of dice (simulate both dice with help of random number generator) and user only wins..

  What is gini index of income inequality

What is Φ (as function of θ)? Provide an analytical solution of Φ when θ = 3 and What happens to Gini index of income inequality as θ increases?

  Function that takes as input parameters

Define a function that takes as input parameters a function handle f, start and end values a and b, and a number of steps n. The function should compute and return the x and y values of the maximum of the function over the range a to b.

  Derive an analytical expression of flux density

Compare the obtained computational results with infinite surface charge approximation - Derive an analytical expression of flux density - Compare the computational results with the analytical solution.

  What are corresponding displacement field and strain field

Write a short Matlab (or whatever language you prefer) program to perform 2 point Gauss integration of a function f over a given interval (a, b). Inputs: a, b, and the functional values of f at the two Gauss points x1 and x2, f 1) and f (x2). (The..

  Directional antennas in a stationary environment

Consider a point-to-point radio link between two highly directional antennas in a stationary environment. The antennas have antenna gains of 30 dB, distance attenuation is 150 dB, and the receiver has a noise figure of 7 dB.

  Calculate and plot the error in the numerical derivative

Write a program to calculate and plot the error in the numerical estimate of the derivative.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd