Write matlab function that used to solve quadratic equation

Assignment Help MATLAB Programming
Reference no: EM131219612

1. You are testing a theory which says that the output displacement of a measurement device should vary with time according to the equation:

D(x) = {x2 cos (x)} / (x +1)

So far, you have measured the following set of experimental data for D and t:

t (min)

0

1

1.5

2

2.5

3

4

5

6

8

10

M (mm)

0.01

.3

.1

-.8

-1.5

-2.2

-2

1.9

5.1

-1.3

-8

1) Plot the function ( ) in the range of . Use increment of 0.1.
2) On the same plot, aslo plot the above Data (M versus t).
3) Add a title, label the axes, and use proper legends appropriately. Submit the graph and the m file (both copied in your word file) you have produced to produce the plot.

2. Write a MATLAB function that can be used to solve a quadratic equation if answers are real numbers (you have to do following steps):

2ax2 - 3bx + 4c = 0

. The inputs to the function are the three coefficients a, b, and c.

. Check if the equation has real solutions. If there is no real solution the program should display ‘THERE ARE NO REAL SOLUTIONS' then quit the program.

. Otherwise, calculate the solutions and display them as shown in the following example (use the fprintf command showing each solution with

4 decimal points). As example:

‘The solutions are -3.4135 and 9.7435'

.Try to solve two quadratic equations with coefficients: [a, b, c] = [1 , 1, -4] and [a,b, c] = [5 -1 3]

Submit the m file for your function, and the results of both test runs done in MATLAB (again copy and paste them in the word file)

3. a) Write a function m-file that will calculate the function f(x)

f(x) = e-x

b) Calculate f(1) in MATLAB and print it in with 15 decimals.

c) The taylor series for the function f(x) is given as

f(x) = ex = 1 - x + x2 / 2 -x3 / 6 + x4 / 24 + ... + (-1)n xn / n! + ...

If we only take 6 terms (including constant term) of this series to compute f(1), what is the true percentage error? Use answer in part (b) as true answer.

4. Answer the following questions (keep your answers short and precise)

a) Explain the differences of operators ‘ * ' and ‘ .* ' in MATLAB.

b) The following MATLAB script is written in MATLAB by another user but when you try to use it function value generate error message. Please correct these statements so it will generate y(x) on the domain, x from 0 to 2π.

Y(x) = {ex cos2 (x)} / (x3 + 3x)

The MATLAB script

x = linspace(0,2pi);

y(x)= ex*cos2(x)/x3+3x

5. Develop a MATLAB function that will compute the following function. Test your function for t = 7, 15, 25 and 100. Include your m file and the output of your tests in the word file.

1329_Function.jpg

Plot the function in the range of -4 ≤ t ≤ 6

Reference no: EM131219612

Questions Cloud

Talking about in practice : What are we talking about in practice when it comes to organize resources, control the results, and ensure expectations are being met?
Major health issue in the united states : Obesity is a major health issue in the United States. What environmental factors do you believe have contributed to obesity? What health concerns can result from obesity? How can advocates, policy makers, and others get individuals to adopt more h..
Concepts in the security techniques : Security Techniques - The learning objective of this assignment is for students to get familiar with the concepts in the security techniques such as symmetric and asymmetric encryption, hashing and certificates in Public Key Infrastructure (PKI).
Problem regarding the positive reinforcements : What attributes do positive reinforcements need to have to motivate behavior?
Write matlab function that used to solve quadratic equation : Write a MATLAB function that can be used to solve a quadratic equation if answers are real numbers (you have to do following steps): 2ax2 - 3bx + 4c = 0. The inputs to the function are the three coefficients a, b, and c.
Environmental factors relevant to organizations : Conduct an analysis of your chosen domain during your chosen time period. If you have selected leaders from different time periods, you will need to compare and contrast the domain analyses between or among the time periods. Your analysis should c..
Hershey company cohesion case : Using the Hershey Company Cohesion Case, the www.finance.yahoo.com information, or other sources, list what you consider to be Hershey's 10 major strenghts, 10 major weaknesses, 10 major opportunities & 10 major threats.
What happens to the portion that is not deducible : Alsop Corporation, a calendar year C Corp, had the following income and expenses in 2015: What is Alsop Corporation’s charitable deduction for 2015? What happens to the portion that is not deducible, if any?
Committee in a managed care organization : 1. What is the role of the credentialing committee in a managed care organization? And why is this function so crucial? 2. What is the role of the medical director in a managed care organization? Why is this such a crucial role for the success of t..

Reviews

Write a Review

MATLAB Programming Questions & Answers

  Write program that representing a month-day and year

How to write a program to determine the day of the week - write a program that inputs three integers representing a month, day, and year. For example, 5 12 2015 represents May 12, 2015.

  Explain why viscosity is an important property in fluid

2. (a) (i) Define dynamic viscosity and give the mathematical formula for Newton's law of viscosity.(ii) How does kinematic viscosity differ from dynamic viscosity?(b) Explain why viscosity is an important property in Fluid Mechanics.

  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..

  Matlab: create a function that will use the secant method

MATLAB: Create a function that will use the Secant method

  Write a matlab routine data matrix containing a multivariate

Write a MATLAB routine A = ChowLiu(X) where X is a D × N data matrix containing a multivariate datapoint on each column that returns a Chow-Liu maximum likelihood tree for X.

  Write a matlab program to analyze a patients ecg signal

Determine the Heart Rate of an ECG Recording of Unknown properties Using MATLAB - Write a MATLAB program to analyze a patient's ECG signal and provide warnings if the heart rate becomes either dangerously low or dangerously high.

  Produce a capital with a modern or a traditional technology

Credit is allocated only to modern sector if and only if R

  Mat lab programming problem

In case the problem in the code I want you to modify it give the correct temperature.

  Applications of multirate digital signal processing

ELEC 0316-SPRING - Discuss the applications of Multirate Digital Signal processing or Explain the need of Multirate Signal Processing with suitable Example.

  Stepper motor driven xy table

Stepper Motor Driven XY Table - Use Matlab and Labjack to acquire digital inputs from limit switches and use Matlab to analyze acquired data

  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..

  Control design using matlab

Control Design using Matlab,  Please try and explain the characteristic of all the plots and graphs.   Import all the required data in word of simply write in the script itself.

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