Question

This must be done in MATLAB (1)We begin with creating the following functions in separate files:...

This must be done in MATLAB

(1)We begin with creating the following functions in separate files: f.m, df.m, g.m, dg.m.

For example, the functions f and g will be, respectively:

function y=f(x) y=atan(x)+x-1; end

function y=g(x) y=x.^3-x-1; end

The functions df and dg are the functions of the derivatives of f and g, and they need to be created in a similar way. Create df and dg functions?

**Next, we will graph each function on the interval [-4, 4] in order to choose an initial approximation 0x. The initial value 0x has to be chosen close to the x-intercept of the function which we are approximating. Below is the code that will allow you to plot the function fun in 2-D in order to choose 0x. The function fun here is a function handle. First, we assign: fun=@f; and, then, we run the code given below: x=linspace(-4,4); y=fun(x); plot(x,y); it outputs the graph of f(x) on the interval [-4, 4].Then, we assign
fun=@g;
and run the code given above one more time to graph the function g.
Both graphs have to be present in your Live Script

Homework Answers

Answer #1

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

clc
clear all
close all
format long;
fun=@f;
x=linspace(-4,4);
y=fun(x);
plot(x,y);
title('Plot of f(x)');
figure;
fun=@g;
x=linspace(-4,4);
y=fun(x);
plot(x,y);
title('Plot of g(x)');
function y=f(x)
y=atan(x)+x-1;
end
function y=df(x)
y=1./(x.^2 + 1) + 1;
end
function y=g(x)
y=x.^3-x-1;
end
function y=dg(x)
y=3*x.^2-1;
end

Kindly revert for any queries

Thanks.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1 Approximation of functions by polynomials Let the function f(x) be given by the following: f(x)...
1 Approximation of functions by polynomials Let the function f(x) be given by the following: f(x) = 1/ 1 + x^2 Use polyfit to approximate f(x) by polynomials of degree k = 2, 4, and 6. Plot the approximating polynomials and f(x) on the same plot over an appropriate domain. Also, plot the approximation error for each case. Note that you also will need polyval to evaluate the approximating polynomial. Submit your code and both plots. Make sure each of...
Q 1) Consider the following functions. f(x) = 2/x,  g(x) = 3x + 12 Find (f ∘...
Q 1) Consider the following functions. f(x) = 2/x,  g(x) = 3x + 12 Find (f ∘ g)(x). Find the domain of (f ∘ g)(x). (Enter your answer using interval notation.) Find (g ∘ f)(x). Find the domain of (g ∘ f)(x).  (Enter your answer using interval notation.) Find (f ∘ f)(x). Find the domain of (f ∘ f)(x).  (Enter your answer using interval notation.) Find (g ∘ g)(x). Find the domain of (g ∘ g)(x). (Enter your answer using interval notation.) Q...
Problem: A non-linear system consists of two functions: Complete the following three parts. Make a table...
Problem: A non-linear system consists of two functions: Complete the following three parts. Make a table of values for the functions. The table can be similar to the one below, or it can be vertical, but it must have a minimum of five x-values and the corresponding function values. Using your table indicate the solution to the system by marking the function values that are equal. x f(x) g(x) Plot a graph of the functions over an interval sufficient to...
Problem 3 you can use Matlab and also i give u the Problem 1 code its...
Problem 3 you can use Matlab and also i give u the Problem 1 code its on Matlab Using the same initial code fragment as in Problem 1, add code that calculates and plays y (n)=h(n)?x (n) where h(n) is the impulse response of an IIR bandpass filter with band edge frequencies 750 Hz and 850 Hz and based on a 4th order Butterworth prototype. Name your program p3.sce this is the Problem 1 code and the solutin clear; clc;...
Problem 1....... you can use Matlab The following Scilab code generates a 10-second “chirp” with discrete...
Problem 1....... you can use Matlab The following Scilab code generates a 10-second “chirp” with discrete frequencies ranging from 0 to 0.2 with a sampling frequency of 8 kHz. clear; Fs = 8000; Nbits = 16; tMax = 10; N = Fs*tMax+1; f = linspace(0.0,0.2,N); x = zeros(f); phi = 0; for n=0:N-1 x(n+1) = 0.8*sin(phi); phi = phi+2*%pi*f(n+1); end sound(x,Fs,Nbits); sleep(10000); //allows full sound to play Add code that calculates and plays y (n)=h(n)?x (n) where h(n) is the...
The table below shows values for four differentiable functions. Suppose we know the following things: h'(x)...
The table below shows values for four differentiable functions. Suppose we know the following things: h'(x) = g(x) g'(x) = f(x) f'(x) = b(x) b'(x) = h(x) 0 1 2 3 4 b(x) 2 4 3 1 0 f(x) 1 4 2 3 0 h(x) 2 0 3 1 4 g(x) 2 0 4 3 1 a) What is intergal from a = 2 and b = 4  f(x) dx? b) What is intergal from a = 0 and b =...
1) find the inverse of the following function and specify the range where the inverse is...
1) find the inverse of the following function and specify the range where the inverse is valid. a) f(x) = 2 + x^2 b) f(x) = 5 - 2x 2)draw the graph of f(x) = 3 - x 3) Evaluate f(2) for f(x) = -10^(-2x) 4) If the y intercept of a function f(x) is 5, determine the y intercepts of following functions: a) g(x) = f(x) + 3 b) h(x) = 2f(x) c) p(x) = 1/(5-f(x)) + 3 d)...
Problem 1 ...... you can use Matlan i got one so all what i need is...
Problem 1 ...... you can use Matlan i got one so all what i need is 2, 3 and 4 one of them or all of them .. thanks The following Scilab code generates a 10-second “chirp” with discrete frequencies ranging from 0 to 0.2 with a sampling frequency of 8 kHz. clear; Fs = 8000; Nbits = 16; tMax = 10; N = Fs*tMax+1; f = linspace(0.0,0.2,N); x = zeros(f); phi = 0; for n=0:N-1 x(n+1) = 0.8*sin(phi); phi...
Solve the following problem using the MATLAB environment Write a function [approx_root, num_its] = bisection(f,a,b,tol) that...
Solve the following problem using the MATLAB environment Write a function [approx_root, num_its] = bisection(f,a,b,tol) that implements the bisection method. You function should take as input 4 arguments with the last argument being optional, i.e, if the user does not provide the accuracy tol use a default of 1.0e-6 (use varargin to attain this). Your function should output the approximate root, approx_root and the number of iterations it took to attain the root, num_its. However, if the user calls the...
1. Let u(x) and v(x) be functions such that u(1)=2,u′(1)=3,v(1)=6,v′(1)=−1 If f(x)=u(x)v(x), what is f′(1). Explain...
1. Let u(x) and v(x) be functions such that u(1)=2,u′(1)=3,v(1)=6,v′(1)=−1 If f(x)=u(x)v(x), what is f′(1). Explain how you arrive at your answer. 2. If f(x) is a function such that f(5)=9 and f′(5)=−4, what is the equation of the tangent line to the graph of y=f(x) at the point x=5? Explain how you arrive at your answer. 3. Find the equation of the tangent line to the function g(x)=xx−2 at the point (3,3). Explain how you arrive at your answer....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT