Question
(1) Input function F(X) from your online assignment 1 (Bisection) to Matlab by using handles to functions of functions like function h below. f =
(1) Input function F(X) from your online assignment 1 (Bisection) to Matlab by using handles to functions of functions like function h below.
f = @(x) x.^2;
g = @(x) 3*x;
h = @(x) g(f(x));
h(3)
ans = 27
***************************
F(X) From Question one:
A=(X + 0.33) / 4.29 B=(X - 3.96) / 4.29 P1=((A-1)**2)*(1+2*A) P2=((B+1)**2)*(1-2*B) F(X) = (P1 * 2.04) + (P2 * (-7.89) )
******************************
(2) Plot (X, F(X)) so we can see all three roots.
(3) Choose three pairs of Xl and Xu from your figure and use
options=optimset(display, iter);
fzeor(F, [Xl Xu], options)
to find the three roots. Check if they are correlated with the roots in your figure.
(4) Find the first, second, third and fourth derivative functions of F(X) from (1) by using diff (see below):
diff -- differentiate symbolic expression or function
Syntax and Description:
diff(F,var)-- differentiates F with respect to the variable var.
diff(F,var,n)-- computes the nth derivative of F with respect to the variable var.
Examples:
Find the derivative of the function sin(x^2).
syms f(x)
f(x) = sin(x^2);
df = diff(f,x)
df(x) =
2*x*cos(x^2)
Find the value of the derivative at x = 2.
Convert the value to double.
df2 = df(2)
df2 =
4*cos(4)
double(df2)
ans =
-2.6146
Higher-Order Derivatives of Univariate Expression
Find the 4th, 5th, and 6th derivatives of this expression:
syms t
d4 = diff(t^6,4)
d5 = diff(t^6,5)
d6 = diff(t^6,6)
d4 =
360*t^2
d5 =
720*t
d6 =
720
Input Arguments
F Expression or function to differentiate, specified as a symbolic expression or function or as a vector or matrix of symbolic expressions or functions. If F is a vector or a matrix, diff differentiates each element of F and returns a vector or a matrix of the same size as F.
var Differentiation variable, specified as a symbolic variable.
n Differentiation order, specified as a non-negative integer.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started