`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
This is happening because when matlab is trying to evaluate the 5+exp(x) as a part of calculation it identifies it as beyond calculation for x=720 but exp(-720) is a number which can be calculated by matlab.So, function gives inf. But, when x=750 both becomes inf and 0. So, inf*0 became an NaN.
So, to have it corrected. h(x) is (5+exp(x))*(exp(-3*x)+exp(-x))
So, expand it, h(x)=5*exp(-x) + exp(-2*x) + 5*exp(-3*x) + 1
So, now below matlab program will run fine
clc
clear all
x=[1,10,100,400,720,750];
h=@(x) 5*exp(-x) + exp(-2*x) + 5*exp(-3*x) + 1;
[x' h(x')]
Kindly revert for any queries
Thanks.
(b) We need to evaluate the function A(x)=[5+e* |e"*" +e*| for very large values of x....
Q1 2016
a) We want to develop a method for calculating the function f(x)
= sin(t)/t
dt
for small or moderately small values of x. this is a special
function called the sine integral, and it is related to another
special function called the exponential integral. it rises in
diffraction problems.
Derive a Taylor-series expression for f(x), and give an upper
bound for the error when the series is terminated after the n-th
order term. sint = see image
b)we...
1. (a) We need to calculate accurate values of the function for very large values of x. However, it is found that just programming this formula into a computer gives very poor accuracy for large x Explain why this happens, and show how to re-write the function so that it can be used reliably, even when x is large. [6 points] (b) In diffraction theory, it is sometimes necessary to evaluate the function sin θ f(x) for small to moderate...
matlab only
Question 5: a.) Write an m-file using conditional statements to evaluate the following function, assuming that the scalar variable x has a value. The function is for x <-1 - 3e y=2+cos(m) for-1 x<5 y 10-5)+1 for r 2 5 Use your file to evaluate y for x5, x-3, and x-15, and Use keyboard entry for values of x. b.) Use a for loop in the above file to plot the above function over the interval -2x <10....
-100x 1. Given the function f(x)=- (1-0.5x) (a) Find the y-intercept point (if there is any): (b) Find the x-intercept point(s) (if there is any): (c) Find f'(x): (d) Find critical number(s) of f(x) (Type 1 and Type 2, if there are any): (e) Find the critical point(s) (if there are any): (f) Find the open x-intervals where f(x) increases and decreases: (g) Find the behavior of the function for very large positive x-values (find limit as x goes to...
(Matlab) Suppose we have a function “hw5f.m” that takes as input
x and outputs the value for a function f(x). Write a Matlab program
that inputs: • interval [a, b]; • m, the number of data points with
evenly spaced nodes from x1 = a to xm = b, and values from f(x); •
location z satisfying x2 < z < xm−1, where h = (b − a)/(m −
1); and outputs the value of the interpolaton polynomial using only...
1. (25 pts) Let f(x) be a continuous function and suppose we are already given the Matlab function "f.", with header "function y fx)", that returns values of f(x) Given the following header for a Matlab function: function [pN] falseposition(c,d,N) complete the function so that it outputs the approximation pN, of the method of false position, using initial guesses po c,pd. You may assume c<d and f(x) has different signs at c and d, however, make sure your program uses...
i need Matlab code asap
Write a program that evaluates the function f(x) = tan’x + x - 2 between -27 and 27 in steps of 1/10 and plots the results. Create a function handle for your function, and use function feval to evaluate your function at the specified points. 2. Write a program that locates the zeros of the function f(x) = cos éx -0.25 between 0 and 27. Use the function fzero to actually locate the zeros of...
#use MATLAB script1) Calculate the following for the function f(x) = e-4x- 2x3 a. Calculate the derivative of the function by hand. Write a MATLAB function that calculates the derivative 05. of this function and calculate the derivative at x = 0.5. b. Develop an M- to evaluate the cetered finite-difference approximation (use equation below), at x = 0.5. Assume that h = 0.1. c. Repeat part (b) for the second-order forward and backward differences. Again Assume that h = 0.1. d. Using the results...
3. Consider the function f(x) = -0.1.24 – 0.15x3 – 0.522 – 0.25x + 1.2. (a) Obtain the analytical expression (i.e. True or Exact Solution) for the first derivative, Eval- uate its value at 1 =0.5. Box your answer and label it as fexact- (b) Now assume the function is discretized on a grid with uniform spacing of h. Evaluate your finite difference approximation at x = 0.5 using central differencing with step sizes starting at 1 and re- duced...
We are the four computed values
of f, IEEE floating point arithmetic is used? You can assume that
exp(x) and exp(-x) are calculated exactly and rounded to the
nearest floating point number
The following lines of MATLAB code evaluate the function 1.5 1016 in four different ways (a) x=1.5e-16; f=0.5*((exp (x)-exp (-x))/x) (b) x -1.5e-16; f - 0.5*((exp(x)-exp(x))/((xt1)-1)) (c) x - 1.5e-16; 0.5* ((exp(x) -exp(-x))/((x-1)+1)) (d) x - 1.5e-16; fexp(x)-exp(-x))/((x+1)+(x-1)) What are the four computed values of f, if IEEE...