I'm a beginner in matlab, and I'm not that bright at calculus, can someone answer and explain to me this problem.

2 views (last 30 days)
menzel villanueva
menzel villanueva on 1 Dec 2021
Answered: Walter Roberson on 31 Dec 2021
This is the problem:
In this problem you will use MATLAB to find the critical values of a function. Recall that the critical values of a function are values of x for which or is undefined, In cases where the derivative function \\\\ can be expressed as a fraction , the critical values of x where either or equal 0 and consequently the derivative equals 0 or does not exist.
Follow the steps to obtain the expressions for the critical value of the function f(x)= x^3/5((4-x)^1/3) :
1. Define the symbolic function corresponding to the formula above.
2. Use the diff function to differentiate and definte the symbolic function
3. Use the numden function to obtain symbolic expressions for the numerator and denominator of , and store them in the variables \\\ and \\\ respectively.
4. Use the solve function along with the n and d to obtain the solutions to the equations and . Assign them to the variables nzeros and dzeros respectively.
This is the code given:
syms x
f(x) = (x^3/5)*((4-x)^1/3)
df(x) = 18/7
[n d] = 0
nzeros = 0
dzeros = 0
%%%%%%% Plotting code below %%%%%%%%
figure; hold on; grid on;
fplot(f(x),'LineWidth',2);
fplot(df(x),'LineWidth',2);
ylim([-6,6]);
legend('$f(x)$','$f''(x)$','Interpreter','latex','FontSize',14);

Answers (2)

Anshika Chourasia
Anshika Chourasia on 31 Dec 2021
Hi,
Please refer the examples discussed in the below links to get more insights on solving a differential equation:
  1. How to create symbolic function
  2. diff and numden to approximate derivates and extract numerator and denominator respectively
  3. dsolve to solve differential equations

Walter Roberson
Walter Roberson on 31 Dec 2021
The equation I use here is deliberately different than what you are using, because you are doing homework.
syms x
f(x) = ((x+1)^(2/7))*((2-x)^(2/11))
f(x) = 
df(x) = diff(f,x)
df(x) = 
[n d] = numden(df)
n(x) = 
d(x) = 
solve(n)
ans = 
solve(d)
ans = 
%%%%%%% Plotting code below %%%%%%%%
figure; hold on; grid on;
fplot(f(x), [-3 3], 'LineWidth',2);
fplot(df(x), [-3 3], 'LineWidth',2);
ylim([-6,6]);
legend('$f(x)$','$f''(x)$','Interpreter','latex','FontSize',14);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by