Question

4. Given (x)=x-5x + 5x5x2 - 6x , write a symbolic MATLAB script that: (a) plots g(x) in the interval -2 <x< 4, (b) finds and
0 0
Add a comment Improve this question Transcribed image text
Answer #1

MATLAB CODE:

clc
clear all
close all

syms x

g(x) = x^5 - 5*x^4 + 5*x^3 + 5*x^2 - 6*x;   % Given g(x)

Dg(x) = diff(g(x),x) == 0;    % Differentiation of g(x)
x_data = vpa(solve(Dg(x),x)); % x-values at which maxima and minima exist

g_data = g(x_data);   % Maxima and Minima of g(x)

fprintf('Maxima and Minima of g(x):\n\n')
disp(g_data)

fplot(x,g(x),[-2 4])
xlabel('x')
ylabel('g(x)')
title('Plot of g(x) in the interval -2 < x < 4')
grid on

x = [-2*pi;pi;0;pi;2*pi];
g = vpa(g(x));

fprintf('The 5 values of g(x) are:\n\n')
disp(g)

OUTPUT:

Plot of g(x) in the interval-2 <x< 4 100 g(x) -100 NE w

Maxima and Minima of g(x): -1.4186966255829238763011422249427 1.4186966255829238763011422249427 3.631432208448840795016989861

Add a comment
Know the answer?
Add Answer to:
4. Given (x)=x-5x + 5x5x2 - 6x , write a symbolic MATLAB script that: (a) plots...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT